-
Notifications
You must be signed in to change notification settings - Fork 163
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
System tray icon #868
base: develop
Are you sure you want to change the base?
System tray icon #868
Conversation
Fixed |
Could anyone check how it works on MacOS? @love-linger? My goal is to make it staying in dock and keep running when window closing button is clicked. Unfortunately, I cannot check it myself. |
4bcf01c
to
329650e
Compare
Add code for creation of system tray icon, menu and handle menu events
only first launched instance creates system tray icon and does not quit
329650e
to
a3d1f78
Compare
Please, check this PR on MacOS |
I'm sorry. As I said in Discussions #805, there's no plan to add this feature into |
Ok. I understand that you don't want to invest your time in this feature. If you are worried that you will have to support this feature, then, please, don't. I'm not going to disappear. |
Implements #805
General description
When this feature is enabled, first launched instance of SourceGit doesn't quit when window closing button is pressed. Instead it hides in system tray and stays running.
This feature can be enabled or disabled either from "Preferences" dialog (menu -> Preferences -> Appearance) or by manually editing
preference.json
file.Implementation details
Window hiding
Sourcegit intercepts
OnClosing
event, cancels it and callsHide
instead (link to code)Preventing from creation of several system tray icons
When another instance of the SourceHGit is launched from the command line or from the system launcher, it will create another identical icon in the system tray, if no additional checking is performed.
To prevent this, every SourceGit instance tries to create a lock file in the system temporary directory (link to code). If this operation fails, it means that another SourceGit is running and the system tray icon is already created. In this case, no system tray icons are created, and
OnClosing
event causes exit.On MacOS no lock file is created, thus relying on the OS guarantees to launch only one instance of a packaged application.
Why?
Because opening application that is already running is still much faster than launch a new instance.
Note
Tested on Windows and Linux only.
MacOS is NOT tested.