- Notifications
You must be signed in to change notification settings - Fork 314
System tray icon#868
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
wl2776 commented Jan 4, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
wl2776 commented Jan 4, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Fixed |
wl2776 commented Jan 5, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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 a3d1f78Comparewl2776 commented Jan 9, 2025
Please, check this PR on MacOS |
love-linger commented Jan 10, 2025
I'm sorry. As I said in Discussions #805, there's no plan to add this feature into |
wl2776 commented Jan 10, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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 6234050Comparewl2776 commented Jan 11, 2025
I have installed macos emulator and tested it myself. Currently doesn't work as intended. Converting to draft. |
57e6665 to 8d265a2Comparelove-linger commented Jan 13, 2025
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 e02eed0CompareUsboKirishima commented Jan 18, 2025
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. |
wl2776 commented Jan 18, 2025
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. |
e0c1fdf to 8930f1dCompare8930f1d to 9e4afe2CompareKobi-Blade commented Feb 9, 2025
The project is open source, it really doesn't matter. Fork and make your own repository with the changes, or just use @wl2776 fork with the implementation. I don't understand all this resistance over a basic feature, it is using the proper tray icon control from Avalonia, the MacOS problem is not for sourcegit to solve (this is a limitation on Avalonia itself, and needs be fixed there). |
9e4afe2 to f2b9ac1CompareAdd 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
f2b9ac1 to 39b391bCompare
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.jsonfile.Implementation details
Window hiding
Sourcegit intercepts
OnClosingevent, cancels it and callsHideinstead (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
OnClosingevent 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.