-
Notifications
You must be signed in to change notification settings - Fork 164
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. |
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. |
a3d1f78
to
6234050
Compare
I have installed macos emulator and tested it myself. Currently doesn't work as intended. Converting to draft. |
57e6665
to
8d265a2
Compare
I don't think you understand what I mean. It's not because of that I don't have time to implement this feature, nor the feature is difficult to implement. Simply because |
e5f6aca
to
e02eed0
Compare
I believe this feature has already been implemented in many other clients, and as a user, I would recommend implementing it as well. It is very convenient to have a program running in the background without needing to keep 256 tabs open, especially since the program is only used for a very small portion of the time during a coding session. |
Could you check how this PR works? I have tested it in Windows and in Linux, and it works as I have intended. MacOS still needs work, since I don't have experience in macOS development. On macOS, I wanted SourceGit to stay in dock (in the bottom of the screen) instead of the system tray (top right corner). Anyway, the window is destroyed, for some reason. |
e02eed0
to
e0c1fdf
Compare
Add code for creation of system tray icon, menu and handle menu events System tray icon - add code for creation of system tray icon, menu and handle menu events - add option to preferences dialog - add a kind of a single instance mode: only first launched instance creates system tray icon and does not quit
e0c1fdf
to
8930f1d
Compare
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.