feat: tray logic in windows

This commit is contained in:
Kingtous
2022-11-02 11:10:28 +08:00
parent 5c8639c603
commit 892869c014
3 changed files with 18 additions and 10 deletions

View File

@@ -399,7 +399,15 @@ class _DesktopHomePageState extends State<DesktopHomePage>
@override
void onTrayIconMouseDown() {
windowManager.show();
windowManager.focus();
}
@override
void onTrayIconRightMouseDown() {
// linux does not support popup menu manually.
// linux will handle popup action ifself.
if (Platform.isMacOS || Platform.isWindows) {
trayManager.popUpContextMenu();
}
}
@override

View File

@@ -511,11 +511,11 @@ class WindowActionPanelState extends State<WindowActionPanel>
if (res) {
// hide for all window
// note: the main window can be restored by tray icon
Future.delayed(Duration.zero, () {
Future.delayed(Duration.zero, () async {
if (widget.isMainWindow) {
windowManager.hide();
await windowManager.hide();
} else {
WindowController.fromWindowId(windowId!).hide();
await WindowController.fromWindowId(windowId!).hide();
}
});
}