Skip to content

Add application tray functionality#857

Open
RxmTaco wants to merge 6 commits intocommetchat:mainfrom
RxmTaco:minimize-to-tray
Open

Add application tray functionality#857
RxmTaco wants to merge 6 commits intocommetchat:mainfrom
RxmTaco:minimize-to-tray

Conversation

@RxmTaco
Copy link
Copy Markdown
Contributor

@RxmTaco RxmTaco commented Mar 19, 2026

This adds a new dependency tray_manager and adds basic tray icon functionality (open/close application) selectable from the tray icon menu. The Minimize on close setting's behavior has been changed to hide the application and retain the tray icon, instead of simply minimizing the application. With the previous implementation of minimize on close, there was no option left to exit the application, so this adds a way to exit the application from the tray icon menu without having to kill it with an external task manager. Process signal handlers for SIGINT and SIGTERM have been added, which fixes #842

@RxmTaco RxmTaco changed the title Added application tray functionality Add application tray functionality Mar 20, 2026
@SpookySkeletons
Copy link
Copy Markdown

Does this add a launch flag for background start of commet?
Does the tray icon indicate notifications?

@RxmTaco
Copy link
Copy Markdown
Contributor Author

RxmTaco commented Mar 24, 2026

The current window management implementation already has the option to pass a command line argument --minimize which remains fully functional. Exception being that instead of just minimizing the application, it now gets minimized to tray during launch.

I had however completely forgotten about notifications, so I have made a new commit which adds a red badge to the tray icon when there are notifications present.

Tray_Notification.mp4

This implementation renders a copy of the default application icon with the added badge overlaid on the image. This image then gets cached to the file cache so it is not re-created every time the icon needs to be updated.
I would like to get some feedback from someone who is more familiar with the caching system if this approach is reasonable and if the caching has been implemented in a desired way.

@RxmTaco
Copy link
Copy Markdown
Contributor Author

RxmTaco commented Mar 27, 2026

Additional linux build requirements:
https://github.com/leanflutter/tray_manager#linux-requirements

@Airyzz
Copy link
Copy Markdown
Contributor

Airyzz commented Mar 30, 2026

the 'Open' context menu item doesn't seem to work for me, but might be a wayland issue or something weird with my setup

@RxmTaco
Copy link
Copy Markdown
Contributor Author

RxmTaco commented Mar 30, 2026

the 'Open' context menu item doesn't seem to work for me, but might be a wayland issue or something weird with my setup

There seem to be some related open issues on window_manager:
Window does not restore from minimization on Linux #525
[Linux] windowManager.show() triggers immediate onWindowMinimize event after user minimizes the window #580

I haven't been able to find a clean fix for this issue. A workaround I found, is to hide the window immediately before restoring/showing it, which would always successfully bring the window to the front. However this would cause the taskbar icon to flash, as the application is briefly removed from it and brought back. This would also cause the taskbar icon to be reordered to the newest position each time 'Open' is selected from the tray context menu, which really is not ideal.

In it's current implementation, if 'Minimize on close' is selected from the settings and the application is closed, the 'Open' context menu item would successfully open and bring the window to the front and the standard minimize/show by clicking on the taskbar icon works as usual. The only case where it fails being if the window has been minimized instead of closed, and then opened through the tray icon instead of the taskbar icon.

So for now the options I see, are to either keep the current implementation with the bug while selecting 'Open' on the tray icon, implement the workaround which causes taskbar icon reordering, or wait till a better workaround or a fix can be found.

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.

"Minimize on close" prevents manual closing and system shutdown (Linux, KDE)

3 participants