Skip to content

An open-source cross-platform alternative to AirDrop

fix: disable tray manager on linux

Tien Do Nam53b1899aec3a
diff --git a/lib/pages/tabs/settings_tab.dart b/lib/pages/tabs/settings_tab.dart
index 4a5a095f..fa065e77 100644
--- a/lib/pages/tabs/settings_tab.dart
+++ b/lib/pages/tabs/settings_tab.dart
@@ -103,13 +103,15 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
),
),
if (checkPlatformIsDesktop()) ...[
- _BooleanEntry(
- label: t.settingsTab.general.minimizeToTray,
- value: settings.minimizeToTray,
- onChanged: (b) async {
- await ref.read(settingsProvider.notifier).setMinimizeToTray(b);
- },
- ),
+ if (checkPlatform([TargetPlatform.windows, TargetPlatform.macOS])) ...[
+ _BooleanEntry(
+ label: t.settingsTab.general.minimizeToTray,
+ value: settings.minimizeToTray,
+ onChanged: (b) async {
+ await ref.read(settingsProvider.notifier).setMinimizeToTray(b);
+ },
+ ),
+ ],
if (checkPlatform([TargetPlatform.windows])) ...[
_SettingsEntry(
label: t.settingsTab.general.launchAtStartup,
diff --git a/lib/util/tray_helper.dart b/lib/util/tray_helper.dart
index 7eff559b..626faf34 100644
--- a/lib/util/tray_helper.dart
+++ b/lib/util/tray_helper.dart
@@ -10,7 +10,7 @@ enum TrayEntry {
}
Future<void> initTray() async {
- if (!checkPlatformIsDesktop()) {
+ if (!checkPlatform([TargetPlatform.windows, TargetPlatform.macOS])) {
return;
}
try {
diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc
index d8d13695..7e11ab27 100644
--- a/linux/flutter/generated_plugin_registrant.cc
+++ b/linux/flutter/generated_plugin_registrant.cc
@@ -8,7 +8,6 @@
#include <desktop_drop/desktop_drop_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
-#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>
@@ -19,9 +18,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
- g_autoptr(FlPluginRegistrar) tray_manager_registrar =
- fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin");
- tray_manager_plugin_register_with_registrar(tray_manager_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake
index 48787dc5..01f60315 100644
--- a/linux/flutter/generated_plugins.cmake
+++ b/linux/flutter/generated_plugins.cmake
@@ -5,7 +5,6 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
screen_retriever
- tray_manager
url_launcher_linux
window_manager
)
diff --git a/linux/my_application.cc b/linux/my_application.cc
index ce573750..55158135 100644
--- a/linux/my_application.cc
+++ b/linux/my_application.cc
@@ -48,7 +48,7 @@ static void my_application_activate(GApplication* application) {
}
gtk_window_set_default_size(window, 400, 500);
- gtk_widget_realize(GTK_WIDGET(window));
+ gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
diff --git a/pubspec.lock b/pubspec.lock
index f1ea4402..90e1a1e4 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1132,9 +1132,11 @@ packages:
tray_manager:
dependency: "direct main"
description:
- name: tray_manager
- url: "https://pub.dartlang.org"
- source: hosted
+ path: "."
+ ref: b37f5e088e0f02c45a684ae41e9d2da2d5c596db
+ resolved-ref: b37f5e088e0f02c45a684ae41e9d2da2d5c596db
+ url: "https://github.com/Tienisto/tray_manager.git"
+ source: git
version: "0.2.0"
typed_data:
dependency: transitive
diff --git a/pubspec.yaml b/pubspec.yaml
index 0fa57329..71b1d2b8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -40,7 +40,11 @@ dependencies:
shelf_router: 1.1.3
slang: 3.9.0
slang_flutter: 3.9.0
- tray_manager: 0.2.0
+ tray_manager:
+ # https://github.com/leanflutter/tray_manager/issues/30
+ git:
+ url: https://github.com/Tienisto/tray_manager.git
+ ref: b37f5e088e0f02c45a684ae41e9d2da2d5c596db
url_launcher: 6.1.7
uuid: 3.0.7
wakelock: 0.6.2