Skip to content

An open-source cross-platform alternative to AirDrop

fix: tray area icon won't disappear (#1208)

zpp019694456caa7afe
diff --git a/app/lib/util/native/tray_helper.dart b/app/lib/util/native/tray_helper.dart
index 708a6bed..52c468dd 100644
--- a/app/lib/util/native/tray_helper.dart
+++ b/app/lib/util/native/tray_helper.dart
@@ -105,3 +105,9 @@ Future<void> showFromTray() async {
// Enable animations
RefenaScope.defaultRef.notifier(sleepProvider).setState((_) => false);
}
+
+Future<void> destroyTray() async {
+ if (!checkPlatform([TargetPlatform.linux])) {
+ await tm.trayManager.destroy();
+ }
+}
diff --git a/app/lib/widget/watcher/window_watcher.dart b/app/lib/widget/watcher/window_watcher.dart
index 37469c42..5615cf17 100644
--- a/app/lib/widget/watcher/window_watcher.dart
+++ b/app/lib/widget/watcher/window_watcher.dart
@@ -101,6 +101,7 @@ class _WindowWatcherState extends State<WindowWatcher> with WindowListener, Refe
if (ref.read(settingsProvider).minimizeToTray) {
await hideToTray();
} else {
+ await destroyTray();
exit(0);
}
} catch (e) {