diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index e569e2511..eb9e0a483 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -399,7 +399,15 @@ class _DesktopHomePageState extends State @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 diff --git a/flutter/lib/desktop/widgets/tabbar_widget.dart b/flutter/lib/desktop/widgets/tabbar_widget.dart index 1f849e453..229e8bd35 100644 --- a/flutter/lib/desktop/widgets/tabbar_widget.dart +++ b/flutter/lib/desktop/widgets/tabbar_widget.dart @@ -511,11 +511,11 @@ class WindowActionPanelState extends State 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(); } }); } diff --git a/flutter/lib/utils/tray_manager.dart b/flutter/lib/utils/tray_manager.dart index 5c665c1bd..91550e1d8 100644 --- a/flutter/lib/utils/tray_manager.dart +++ b/flutter/lib/utils/tray_manager.dart @@ -16,15 +16,15 @@ Future initTray({List? extra_item}) async { if (extra_item != null) { items.insertAll(0, extra_item); } - await Future.wait([ - trayManager - .setIcon(Platform.isWindows ? "assets/logo.ico" : "assets/logo.png"), - trayManager.setContextMenu(Menu(items: items)), - trayManager.setTitle("rustdesk") - ]); if (Platform.isMacOS || Platform.isWindows) { await trayManager.setToolTip("rustdesk"); } + if (Platform.isMacOS || Platform.isLinux) { + await trayManager.setTitle("rustdesk"); + } + await trayManager + .setIcon(Platform.isWindows ? "assets/logo.ico" : "assets/logo.png"); + await trayManager.setContextMenu(Menu(items: items)); } Future destoryTray() async {