Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove broken tray #893

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ jobs:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: sudo apt update
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev libayatana-appindicator3-dev
- run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev
- run: flutter pub get
- run: flutter build linux -v
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
# channel: 'stable'
# flutter-version: ${{env.FLUTTER_VERSION}}
# - run: sudo apt update
# - run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev libayatana-appindicator3-dev
# - run: sudo apt install -y clang cmake curl libgtk-3-dev ninja-build pkg-config unzip libunwind-dev libmpv-dev
# - run: flutter pub get

# - uses: snapcore/action-build@v1
Expand Down
36 changes: 1 addition & 35 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:phoenix_theme/phoenix_theme.dart' hide ColorX, isMobile;
import 'package:system_theme/system_theme.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:watch_it/watch_it.dart';
import 'package:window_manager/window_manager.dart';
import 'package:yaru/yaru.dart';

import '../../common/view/theme.dart';
Expand All @@ -17,7 +14,6 @@ import '../../settings/settings_model.dart';
import '../connectivity_model.dart';
import 'scaffold.dart';
import 'splash_screen.dart';
import 'system_tray.dart';

class YaruMusicPodApp extends StatelessWidget {
const YaruMusicPodApp({super.key});
Expand Down Expand Up @@ -67,8 +63,7 @@ class _MusicPodApp extends StatefulWidget with WatchItStatefulWidgetMixin {
State<_MusicPodApp> createState() => _MusicPodAppState();
}

class _MusicPodAppState extends State<_MusicPodApp>
with WindowListener, TrayListener {
class _MusicPodAppState extends State<_MusicPodApp> {
late Future<bool> _initFuture;

@override
Expand All @@ -82,38 +77,9 @@ class _MusicPodAppState extends State<_MusicPodApp>
await di<LibraryModel>().init();
if (!mounted) return false;
di<ExternalPathService>().init();
if (Platform.isLinux) {
windowManager.addListener(this);
trayManager.addListener(this);
}
return true;
}

@override
void dispose() {
if (Platform.isLinux) {
windowManager.removeListener(this);
trayManager.removeListener(this);
}
super.dispose();
}

@override
void onTrayIconMouseDown() {
trayManager.popUpContextMenu();
}

@override
void onWindowEvent(String eventName) {
if ('show' == eventName || 'hide' == eventName) {
updateTrayItems(context);
}
super.onWindowEvent(eventName);
}

@override
void onTrayMenuItemClick(MenuItem menuItem) => reactToTray(menuItem);

@override
Widget build(BuildContext context) {
final themeIndex = watchPropertyValue((SettingsModel m) => m.themeIndex);
Expand Down
72 changes: 0 additions & 72 deletions lib/app/view/system_tray.dart

This file was deleted.

27 changes: 5 additions & 22 deletions lib/common/view/header_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:phoenix_theme/phoenix_theme.dart' hide isMobile;
import 'package:watch_it/watch_it.dart';
import 'package:yaru/yaru.dart';

import '../../app/app_model.dart';
import '../../extensions/build_context_x.dart';
import '../../l10n/l10n.dart';
Expand All @@ -9,11 +14,6 @@ import '../data/close_btn_action.dart';
import 'global_keys.dart';
import 'icons.dart';
import 'nav_back_button.dart';
import 'package:flutter/material.dart';
import 'package:phoenix_theme/phoenix_theme.dart' hide isMobile;
import 'package:watch_it/watch_it.dart';
import 'package:yaru/yaru.dart';

import 'theme.dart';

class HeaderBar extends StatelessWidget
Expand Down Expand Up @@ -45,8 +45,6 @@ class HeaderBar extends StatelessWidget
@override
Widget build(BuildContext context) {
final canPop = watchPropertyValue((LibraryModel m) => m.canPop);
final closeBtnAction =
watchPropertyValue((SettingsModel m) => m.closeBtnActionIndex);

Widget? leading;

Expand Down Expand Up @@ -103,21 +101,6 @@ class HeaderBar extends StatelessWidget
backgroundColor ?? context.theme.scaffoldBackgroundColor,
style: theStyle,
foregroundColor: foregroundColor,
onClose: Platform.isLinux
? (context) {
switch (closeBtnAction) {
case CloseBtnAction.alwaysAsk:
showDialog(
context: context,
builder: (_) => const CloseWindowActionConfirmDialog(),
);
case CloseBtnAction.hideToTray:
YaruWindow.hide(context);
case CloseBtnAction.close:
YaruWindow.close(context);
}
}
: null,
),
);
}
Expand Down
5 changes: 1 addition & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import '../../library/library_model.dart';
import 'app/app_model.dart';
import 'app/connectivity_model.dart';
import 'app/view/app.dart';
import 'app/view/system_tray.dart';
import 'constants.dart';
import 'library/library_service.dart';
import 'local_audio/local_audio_model.dart';
Expand All @@ -44,9 +43,7 @@ Future<void> main(List<String> args) async {
WindowManager.instance
..setMinimumSize(const Size(500, 700))
..setSize(const Size(950, 820));
if (Platform.isLinux) {
await initTray();
} else {
if (!Platform.isLinux) {
SystemTheme.fallbackColor = Colors.greenAccent;
await SystemTheme.accentColor.load();
}
Expand Down
17 changes: 9 additions & 8 deletions lib/settings/view/settings_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:path/path.dart' as p;
import 'package:url_launcher/url_launcher.dart';
Expand Down Expand Up @@ -42,12 +40,11 @@ class SettingsPage extends StatelessWidget {
),
Expanded(
child: ListView(
children: [
const _ThemeSection(),
if (Platform.isLinux) const _CloseActionSection(),
const _PodcastSection(),
const _LocalAudioSection(),
const _AboutSection(),
children: const [
_ThemeSection(),
_PodcastSection(),
_LocalAudioSection(),
_AboutSection(),
],
),
),
Expand Down Expand Up @@ -103,6 +100,10 @@ class _ThemeSection extends StatelessWidget with WatchItMixin {
}
}

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

Expand Down
4 changes: 0 additions & 4 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <screen_retriever/screen_retriever_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>
#include <yaru_window_linux/yaru_window_linux_plugin.h>
Expand Down Expand Up @@ -48,9 +47,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) system_theme_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SystemThemePlugin");
system_theme_plugin_register_with_registrar(system_theme_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);
Expand Down
1 change: 0 additions & 1 deletion linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever
super_native_extensions
system_theme
tray_manager
url_launcher_linux
window_manager
yaru_window_linux
Expand Down
2 changes: 0 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import shared_preferences_foundation
import sqflite
import super_native_extensions
import system_theme
import tray_manager
import url_launcher_macos
import wakelock_plus
import window_manager
Expand All @@ -43,7 +42,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin"))
SystemThemePlugin.register(with: registry.registrar(forPlugin: "SystemThemePlugin"))
TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
Expand Down
24 changes: 0 additions & 24 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -901,14 +901,6 @@ packages:
url: "https://github.com/media-kit/media-kit"
source: git
version: "1.2.4"
menu_base:
dependency: transitive
description:
name: menu_base
sha256: "820368014a171bd1241030278e6c2617354f492f5c703d7b7d4570a6b8b84405"
url: "https://pub.dev"
source: hosted
version: "0.1.1"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -1358,14 +1350,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0"
shortid:
dependency: transitive
description:
name: shortid
sha256: d0b40e3dbb50497dad107e19c54ca7de0d1a274eb9b4404991e443dadb9ebedb
url: "https://pub.dev"
source: hosted
version: "0.1.2"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -1531,14 +1515,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.1"
tray_manager:
dependency: "direct main"
description:
name: tray_manager
sha256: c9a63fd88bd3546287a7eb8ccc978d707eef82c775397af17dda3a4f4c039e64
url: "https://pub.dev"
source: hosted
version: "0.2.3"
tuple:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ dependencies:
smtc_windows: ^0.1.3
super_drag_and_drop: ^0.8.18
system_theme: ^3.0.0
tray_manager: ^0.2.3
url_launcher: ^6.3.0
watch_it: ^1.4.2
win32: ^5.5.4
Expand Down
2 changes: 0 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ parts:
dart pub get
flutter build linux --release -v
cp -r build/linux/*/release/bundle/* $CRAFT_PART_INSTALL/bin/
build-packages:
- libayatana-appindicator3-dev
deps:
plugin: nil
Expand Down
3 changes: 0 additions & 3 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <screen_retriever/screen_retriever_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin_c_api.h>
#include <system_theme/system_theme_plugin.h>
#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_manager/window_manager_plugin.h>

Expand All @@ -38,8 +37,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
SystemThemePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SystemThemePlugin"));
TrayManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("TrayManagerPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowManagerPluginRegisterWithRegistrar(
Expand Down
1 change: 0 additions & 1 deletion windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever
super_native_extensions
system_theme
tray_manager
url_launcher_windows
window_manager
)
Expand Down