Skip to content

Commit b06aa1f

Browse files
authored
fix: remove broken tray (ubuntu-flutter-community#893)
1 parent b70b275 commit b06aa1f

15 files changed

+18
-181
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ jobs:
4949
channel: 'stable'
5050
flutter-version: ${{env.FLUTTER_VERSION}}
5151
- run: sudo apt update
52-
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev libayatana-appindicator3-dev
52+
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev
5353
- run: flutter pub get
5454
- run: flutter build linux -v

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
# channel: 'stable'
9797
# flutter-version: ${{env.FLUTTER_VERSION}}
9898
# - run: sudo apt update
99-
# - run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev libayatana-appindicator3-dev
99+
# - run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev
100100
# - run: flutter pub get
101101

102102
# - uses: snapcore/action-build@v1

lib/app/view/app.dart

+1-35
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import 'dart:io';
21
import 'dart:ui';
32

43
import 'package:flutter/material.dart';
54
import 'package:phoenix_theme/phoenix_theme.dart' hide ColorX, isMobile;
65
import 'package:system_theme/system_theme.dart';
7-
import 'package:tray_manager/tray_manager.dart';
86
import 'package:watch_it/watch_it.dart';
9-
import 'package:window_manager/window_manager.dart';
107
import 'package:yaru/yaru.dart';
118

129
import '../../common/view/theme.dart';
@@ -17,7 +14,6 @@ import '../../settings/settings_model.dart';
1714
import '../connectivity_model.dart';
1815
import 'scaffold.dart';
1916
import 'splash_screen.dart';
20-
import 'system_tray.dart';
2117

2218
class YaruMusicPodApp extends StatelessWidget {
2319
const YaruMusicPodApp({super.key});
@@ -67,8 +63,7 @@ class _MusicPodApp extends StatefulWidget with WatchItStatefulWidgetMixin {
6763
State<_MusicPodApp> createState() => _MusicPodAppState();
6864
}
6965

70-
class _MusicPodAppState extends State<_MusicPodApp>
71-
with WindowListener, TrayListener {
66+
class _MusicPodAppState extends State<_MusicPodApp> {
7267
late Future<bool> _initFuture;
7368

7469
@override
@@ -82,38 +77,9 @@ class _MusicPodAppState extends State<_MusicPodApp>
8277
await di<LibraryModel>().init();
8378
if (!mounted) return false;
8479
di<ExternalPathService>().init();
85-
if (Platform.isLinux) {
86-
windowManager.addListener(this);
87-
trayManager.addListener(this);
88-
}
8980
return true;
9081
}
9182

92-
@override
93-
void dispose() {
94-
if (Platform.isLinux) {
95-
windowManager.removeListener(this);
96-
trayManager.removeListener(this);
97-
}
98-
super.dispose();
99-
}
100-
101-
@override
102-
void onTrayIconMouseDown() {
103-
trayManager.popUpContextMenu();
104-
}
105-
106-
@override
107-
void onWindowEvent(String eventName) {
108-
if ('show' == eventName || 'hide' == eventName) {
109-
updateTrayItems(context);
110-
}
111-
super.onWindowEvent(eventName);
112-
}
113-
114-
@override
115-
void onTrayMenuItemClick(MenuItem menuItem) => reactToTray(menuItem);
116-
11783
@override
11884
Widget build(BuildContext context) {
11985
final themeIndex = watchPropertyValue((SettingsModel m) => m.themeIndex);

lib/app/view/system_tray.dart

-72
This file was deleted.

lib/common/view/header_bar.dart

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import 'dart:io';
22

3+
import 'package:flutter/material.dart';
4+
import 'package:phoenix_theme/phoenix_theme.dart' hide isMobile;
5+
import 'package:watch_it/watch_it.dart';
6+
import 'package:yaru/yaru.dart';
7+
38
import '../../app/app_model.dart';
49
import '../../extensions/build_context_x.dart';
510
import '../../l10n/l10n.dart';
@@ -9,11 +14,6 @@ import '../data/close_btn_action.dart';
914
import 'global_keys.dart';
1015
import 'icons.dart';
1116
import 'nav_back_button.dart';
12-
import 'package:flutter/material.dart';
13-
import 'package:phoenix_theme/phoenix_theme.dart' hide isMobile;
14-
import 'package:watch_it/watch_it.dart';
15-
import 'package:yaru/yaru.dart';
16-
1717
import 'theme.dart';
1818

1919
class HeaderBar extends StatelessWidget
@@ -45,8 +45,6 @@ class HeaderBar extends StatelessWidget
4545
@override
4646
Widget build(BuildContext context) {
4747
final canPop = watchPropertyValue((LibraryModel m) => m.canPop);
48-
final closeBtnAction =
49-
watchPropertyValue((SettingsModel m) => m.closeBtnActionIndex);
5048

5149
Widget? leading;
5250

@@ -103,21 +101,6 @@ class HeaderBar extends StatelessWidget
103101
backgroundColor ?? context.theme.scaffoldBackgroundColor,
104102
style: theStyle,
105103
foregroundColor: foregroundColor,
106-
onClose: Platform.isLinux
107-
? (context) {
108-
switch (closeBtnAction) {
109-
case CloseBtnAction.alwaysAsk:
110-
showDialog(
111-
context: context,
112-
builder: (_) => const CloseWindowActionConfirmDialog(),
113-
);
114-
case CloseBtnAction.hideToTray:
115-
YaruWindow.hide(context);
116-
case CloseBtnAction.close:
117-
YaruWindow.close(context);
118-
}
119-
}
120-
: null,
121104
),
122105
);
123106
}

lib/main.dart

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import '../../library/library_model.dart';
1919
import 'app/app_model.dart';
2020
import 'app/connectivity_model.dart';
2121
import 'app/view/app.dart';
22-
import 'app/view/system_tray.dart';
2322
import 'constants.dart';
2423
import 'library/library_service.dart';
2524
import 'local_audio/local_audio_model.dart';
@@ -44,9 +43,7 @@ Future<void> main(List<String> args) async {
4443
WindowManager.instance
4544
..setMinimumSize(const Size(500, 700))
4645
..setSize(const Size(950, 820));
47-
if (Platform.isLinux) {
48-
await initTray();
49-
} else {
46+
if (!Platform.isLinux) {
5047
SystemTheme.fallbackColor = Colors.greenAccent;
5148
await SystemTheme.accentColor.load();
5249
}

lib/settings/view/settings_page.dart

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:io';
2-
31
import 'package:flutter/material.dart';
42
import 'package:path/path.dart' as p;
53
import 'package:url_launcher/url_launcher.dart';
@@ -42,12 +40,11 @@ class SettingsPage extends StatelessWidget {
4240
),
4341
Expanded(
4442
child: ListView(
45-
children: [
46-
const _ThemeSection(),
47-
if (Platform.isLinux) const _CloseActionSection(),
48-
const _PodcastSection(),
49-
const _LocalAudioSection(),
50-
const _AboutSection(),
43+
children: const [
44+
_ThemeSection(),
45+
_PodcastSection(),
46+
_LocalAudioSection(),
47+
_AboutSection(),
5148
],
5249
),
5350
),
@@ -103,6 +100,10 @@ class _ThemeSection extends StatelessWidget with WatchItMixin {
103100
}
104101
}
105102

103+
// TODO: figure out how to show the window from clicking the dock icon in macos, windows and linux
104+
// Also figure out how to show the window again, when the gtk window is triggered from the outside (open with)
105+
// if we can not figure this out, we can not land this feature.
106+
// ignore: unused_element
106107
class _CloseActionSection extends StatelessWidget with WatchItMixin {
107108
const _CloseActionSection();
108109

linux/flutter/generated_plugin_registrant.cc

-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <screen_retriever/screen_retriever_plugin.h>
1616
#include <super_native_extensions/super_native_extensions_plugin.h>
1717
#include <system_theme/system_theme_plugin.h>
18-
#include <tray_manager/tray_manager_plugin.h>
1918
#include <url_launcher_linux/url_launcher_plugin.h>
2019
#include <window_manager/window_manager_plugin.h>
2120
#include <yaru_window_linux/yaru_window_linux_plugin.h>
@@ -48,9 +47,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
4847
g_autoptr(FlPluginRegistrar) system_theme_registrar =
4948
fl_plugin_registry_get_registrar_for_plugin(registry, "SystemThemePlugin");
5049
system_theme_plugin_register_with_registrar(system_theme_registrar);
51-
g_autoptr(FlPluginRegistrar) tray_manager_registrar =
52-
fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin");
53-
tray_manager_plugin_register_with_registrar(tray_manager_registrar);
5450
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
5551
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
5652
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

linux/flutter/generated_plugins.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
1212
screen_retriever
1313
super_native_extensions
1414
system_theme
15-
tray_manager
1615
url_launcher_linux
1716
window_manager
1817
yaru_window_linux

macos/Flutter/GeneratedPluginRegistrant.swift

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import shared_preferences_foundation
2121
import sqflite
2222
import super_native_extensions
2323
import system_theme
24-
import tray_manager
2524
import url_launcher_macos
2625
import wakelock_plus
2726
import window_manager
@@ -43,7 +42,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
4342
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
4443
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
4544
SystemThemePlugin.register(with: registry.registrar(forPlugin: "SystemThemePlugin"))
46-
TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))
4745
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
4846
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
4947
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))

pubspec.lock

-24
Original file line numberDiff line numberDiff line change
@@ -901,14 +901,6 @@ packages:
901901
url: "https://github.com/media-kit/media-kit"
902902
source: git
903903
version: "1.2.4"
904-
menu_base:
905-
dependency: transitive
906-
description:
907-
name: menu_base
908-
sha256: "820368014a171bd1241030278e6c2617354f492f5c703d7b7d4570a6b8b84405"
909-
url: "https://pub.dev"
910-
source: hosted
911-
version: "0.1.1"
912904
meta:
913905
dependency: transitive
914906
description:
@@ -1358,14 +1350,6 @@ packages:
13581350
url: "https://pub.dev"
13591351
source: hosted
13601352
version: "3.0.0"
1361-
shortid:
1362-
dependency: transitive
1363-
description:
1364-
name: shortid
1365-
sha256: d0b40e3dbb50497dad107e19c54ca7de0d1a274eb9b4404991e443dadb9ebedb
1366-
url: "https://pub.dev"
1367-
source: hosted
1368-
version: "0.1.2"
13691353
sky_engine:
13701354
dependency: transitive
13711355
description: flutter
@@ -1531,14 +1515,6 @@ packages:
15311515
url: "https://pub.dev"
15321516
source: hosted
15331517
version: "1.0.1"
1534-
tray_manager:
1535-
dependency: "direct main"
1536-
description:
1537-
name: tray_manager
1538-
sha256: c9a63fd88bd3546287a7eb8ccc978d707eef82c775397af17dda3a4f4c039e64
1539-
url: "https://pub.dev"
1540-
source: hosted
1541-
version: "0.2.3"
15421518
tuple:
15431519
dependency: transitive
15441520
description:

pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ dependencies:
7171
smtc_windows: ^0.1.3
7272
super_drag_and_drop: ^0.8.18
7373
system_theme: ^3.0.0
74-
tray_manager: ^0.2.3
7574
url_launcher: ^6.3.0
7675
watch_it: ^1.4.2
7776
win32: ^5.5.4

snap/snapcraft.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ parts:
9898
dart pub get
9999
flutter build linux --release -v
100100
cp -r build/linux/*/release/bundle/* $CRAFT_PART_INSTALL/bin/
101-
build-packages:
102-
- libayatana-appindicator3-dev
103101
104102
deps:
105103
plugin: nil

windows/flutter/generated_plugin_registrant.cc

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <screen_retriever/screen_retriever_plugin.h>
1616
#include <super_native_extensions/super_native_extensions_plugin_c_api.h>
1717
#include <system_theme/system_theme_plugin.h>
18-
#include <tray_manager/tray_manager_plugin.h>
1918
#include <url_launcher_windows/url_launcher_windows.h>
2019
#include <window_manager/window_manager_plugin.h>
2120

@@ -38,8 +37,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
3837
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
3938
SystemThemePluginRegisterWithRegistrar(
4039
registry->GetRegistrarForPlugin("SystemThemePlugin"));
41-
TrayManagerPluginRegisterWithRegistrar(
42-
registry->GetRegistrarForPlugin("TrayManagerPlugin"));
4340
UrlLauncherWindowsRegisterWithRegistrar(
4441
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
4542
WindowManagerPluginRegisterWithRegistrar(

windows/flutter/generated_plugins.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
1212
screen_retriever
1313
super_native_extensions
1414
system_theme
15-
tray_manager
1615
url_launcher_windows
1716
window_manager
1817
)

0 commit comments

Comments
 (0)