diff --git a/lib/app/view/system_tray.dart b/lib/app/view/system_tray.dart index bec40e0f8..1792c3ba9 100644 --- a/lib/app/view/system_tray.dart +++ b/lib/app/view/system_tray.dart @@ -4,17 +4,14 @@ import 'package:flutter/material.dart'; import 'package:tray_manager/tray_manager.dart'; import 'package:window_manager/window_manager.dart'; +import '../../constants.dart'; import '../../l10n/l10n.dart'; const _exitAppMenuKey = 'exit_app'; const _showHideWindowMenuKey = 'show_hide_window'; Future initTray() async { - await trayManager.setIcon( - (Platform.isWindows) - ? 'assets/images/tray_icon.ico' - : 'assets/images/tray_icon.png', - ); + await trayManager.setIcon(_icon()); Menu menu = Menu( items: [ MenuItem( @@ -31,6 +28,16 @@ Future initTray() async { await trayManager.setContextMenu(menu); } +String _icon() { + if (Platform.isLinux) { + return kAppId; + } else if (Platform.isWindows) { + return 'assets/images/tray_icon.ico'; + } else { + return 'assets/images/tray_icon.png'; + } +} + Future updateTrayItems(BuildContext context) async { bool isVisible = await windowManager.isVisible(); if (!context.mounted) return; diff --git a/lib/constants.dart b/lib/constants.dart index b0bff436e..5ba2d278b 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -3,6 +3,8 @@ import 'package:yaru/constants.dart'; const kAppName = 'musicpod'; +const kAppId = 'org.feichtmeier.Musicpod'; + const kLinuxDBusName = 'org.mpris.MediaPlayer2.musicpod'; const kAndroidChannelId = 'org.feichtmeier.musicpod.channel.audio';