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

feat(app): add system tray functionality #824

Merged

Conversation

dongfengweixiao
Copy link
Contributor

@dongfengweixiao dongfengweixiao commented Aug 4, 2024

  • Update pubspec.yaml with tray_manager dependency.
  • Initialize system tray in app.dart and handle menu item clicks.

Ref #793

@dongfengweixiao dongfengweixiao force-pushed the feature/system_tray branch 2 times, most recently from 3b5f9fd to ce0bbcd Compare August 4, 2024 03:43
Copy link
Member

@Feichtmeier Feichtmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey again 👋
Added three change requests/helps

I noticed two things also:

  • on linux the dialog pops up and if you do so the app is successfully put into tray and still running and reacting to gnome shell play/pause, however clicking the icon does not return the app to visible mode
  • on macos it didnt work at all :( the app just closed, but we could also just add this only for linux and I can try to make it work for macos and windows after your PR (no ETA), that would mean instead of checking for !isMobile you check for Platform.isLinux

lib/main.dart Outdated Show resolved Hide resolved
lib/settings/view/settings_page.dart Outdated Show resolved Hide resolved
lib/app/view/system_tray.dart Show resolved Hide resolved
@dongfengweixiao
Copy link
Contributor Author

dongfengweixiao commented Aug 4, 2024

Hey again 👋 Added three change requests/helps

I noticed two things also:

* on linux the dialog pops up and if you do so the app is successfully put into tray and still running and reacting to gnome shell play/pause, however clicking the icon does not return the app to visible mode

* on macos it didnt work at all :( the app just closed, but we could also just add this only for linux and I can try to make it work for macos and windows after your PR (no ETA), that would mean instead of checking for !isMobile you check for Platform.isLinux

I checked other apps using the tray_manager library, and none of them can open a window by clicking on the icon in Linux. Some programs have conditions in their code to show/hide the window if the system is Windows, otherwise, they display a popup menu. As for the behavior on macOS, I cannot verify it because I don't have the corresponding environment.

@Feichtmeier
Copy link
Member

Hey again 👋 Added three change requests/helps
I noticed two things also:

* on linux the dialog pops up and if you do so the app is successfully put into tray and still running and reacting to gnome shell play/pause, however clicking the icon does not return the app to visible mode

* on macos it didnt work at all :( the app just closed, but we could also just add this only for linux and I can try to make it work for macos and windows after your PR (no ETA), that would mean instead of checking for !isMobile you check for Platform.isLinux

I checked other apps using the tray_manager library, and none of them can open a window by clicking on the icon in Linux. Some programs have conditions in their code to show/hide the window if the system is Windows, otherwise, they display a popup menu. As for the behavior on macOS, I cannot verify it because I don't have the corresponding environment.

it doesnt need to be the icon but if the icon with a minimized app would show a menu and one of the menu items is "show window"->click->shows window this would be enough (like in discord/telegram etc)

@dongfengweixiao
Copy link
Contributor Author

Hey again 👋 Added three change requests/helps
I noticed two things also:

* on linux the dialog pops up and if you do so the app is successfully put into tray and still running and reacting to gnome shell play/pause, however clicking the icon does not return the app to visible mode

* on macos it didnt work at all :( the app just closed, but we could also just add this only for linux and I can try to make it work for macos and windows after your PR (no ETA), that would mean instead of checking for !isMobile you check for Platform.isLinux

I checked other apps using the tray_manager library, and none of them can open a window by clicking on the icon in Linux. Some programs have conditions in their code to show/hide the window if the system is Windows, otherwise, they display a popup menu. As for the behavior on macOS, I cannot verify it because I don't have the corresponding environment.

it doesnt need to be the icon but if the icon with a minimized app would show a menu and one of the menu items is "show window"->click->shows window this would be enough (like in discord/telegram etc)

Clicking the icon to show/hide the window seems to be possible in Linux for qt programs, but not for gtk3 programs.

@Feichtmeier
Copy link
Member

hey, was said on discord, sorry for the wrong direction, it needs to be like in the example of the package and the musicpod state class needs with TrayListener

grafik
grafik
grafik

I only added !isMobile checks and the di.reset() ontop

@Feichtmeier Feichtmeier force-pushed the main branch 9 times, most recently from 2293332 to 20d9eb4 Compare August 20, 2024 15:21
- Update pubspec.yaml with tray_manager dependency.
- Initialize system tray in app.dart and handle menu item clicks.
Copy link
Member

@Feichtmeier Feichtmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep it for linux for now so we can test it with the next snap edge release. I got fixed ready which will be pushed then this will be merged and we can test it on linux in the snap edge

@Feichtmeier Feichtmeier enabled auto-merge (squash) August 21, 2024 20:28
@Feichtmeier Feichtmeier disabled auto-merge August 21, 2024 20:30
@Feichtmeier Feichtmeier enabled auto-merge (squash) August 21, 2024 20:35
@Feichtmeier Feichtmeier merged commit 857bdef into ubuntu-flutter-community:main Aug 21, 2024
4 checks passed
@dongfengweixiao dongfengweixiao deleted the feature/system_tray branch August 22, 2024 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants