Closed Sushma-Shrestha closed 1 year ago
I suggest making both onWindowBlur and on icon click call one function, since they do the same thing anyway, right? Now debounce that function. Make that function only be able to execute if the delay between the first and the second call is more than the time required to minimize/hide the window.
That's my immediate thought of a simple workaround
@damywise How can we make it the same function? As for onWindowBlur, we override the function of window manager, @override void onWindowBlur() async { (Platform.isWindows) ? windowManager.minimize() : await windowManager.hide(); }
And for system tray we will do this, systemTray.registerSystemTrayEventHandler((eventName) async { windowManager.removeListener(this);
debugPrint("eventName: $eventName");
if (eventName == kSystemTrayEventClick) {
if (await windowManager.isMinimized()) {
await windowManager.restore();
} else {
await windowManager.minimize();
}
if (eventName == kSystemTrayEventRightClick) {
await systemTray.popUpContextMenu();
}
});
It is taking even the click on the application's icon as onWindowBlur, I am facing this issue and cannot solve it. The video link is given below of flickering effect: https://screenrec.com/share/qhKBFVsIwQ I want my application to be able to toggle as well as make it disappear on blur, but the onWindowBlur takes the application icon click as blur, and it makes it look so uncomfortable user experience with this flickering effect it has reproduced.
I found that another issue is also created for this case: https://github.com/leanflutter/window_manager/issues/294
I want to get advice on what can be done. I will really appreciate any response.