-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added hide to tray option #6915
base: development
Are you sure you want to change the base?
Conversation
Head branch was pushed to by a user without write access
Please fix the build and revert all unrelated changes such as the dependency additions, there is no need to manually extract anything from the asar file and the translations are overkill at the moment (especially pulling in multiple dependencies just to translate 2 strings). Even after the corrections there are still open questions such as how to handle multiple windows. |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Thanks for the review, I reverted the new dependencies (I didn't know you could read asar directly from node fs! It's much better now). About the i18n, if needed maybe we could send the translated text via IPC and recreate the tray. As for how to handle multiple windows, I didn't know you could have more than one, is there some kind of setting for that? |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Head branch was pushed to by a user without write access
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Looks like you may have mistakenly used npm instead of yarn to install the dependencies and pushed a package-lock.json file, additionally there seem to be changes to the yarn.lock file which shouldn't really be there as the dependencies are no longer changing in this PR. |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
@absidue Thanks a lot, seems to be working fine now. Right now there's no need to do anything to the PR on my side for the review, right? |
The biggest open question is how to handle multiple windows with this tray stuff. You can open new windows in many different ways, it is not an obscure feature:
|
Head branch was pushed to by a user without write access
@absidue I've pushed some changes to add support for multiple windows, now the tray looks like this: For every window you hide, there will be a menu in the tray with the window's title and a submenu for showing or closing it. If there's only one hidden window, you can show it by clicking on the tray icon too. If every window is closed using the submenu option and there are no opened windows, or if you select the Quit option, the app will exit. |
Thanks for the tip! I've updated my previous comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is essentially just a more complicated way of minimising a window, lets treat it the same way. Please remove the hide on close option and make sure when the mainWindow is hidden that it gets shown when opening a link from a web browser, the behaviour should match what happens when a window is minimised the normal way.
Additionally if the Hide to tray on minimise setting is disabled while some windows are hidden and the tray icon exists, all windows should be shown and the tray icon removed.
Seeing 2 tray icons and show and close doenst work if there is two of them. VirtualBoxVM_weorUSYvw5.mp4 |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
@absidue Everything is changed as you asked, though I couldn't test the mainWindow behaviour for MacOS when opening a link from the web browser (line 1842 at src/main/index.js) @efb4f5ff-1298-471a-8973-3d47447115dc thanks for reporting this, unfortunately it seems to be an Electron bug in Linux as stated here. I tried a couple of things to fix it with no success, I'll see if I can find some workaround tomorrow. |
Head branch was pushed to by a user without write access
@efb4f5ff-1298-471a-8973-3d47447115dc @absidue I've pushed a workaround for the Linux issue. I wasn't able to make the tray disappear, so I decided to keep it always visible (only on Linux) and just update the menu, which seems to work fine. It shows the tray when enabling the option and when starting the app if the option is enabled, but I couldn't make it disappear when disabling the option for obvious reasons. I've also fixed the submenu close option, which wasn't working as intended after the last changes. |
Added hide to tray option
Pull Request Type
Related issue
#59
Description
Adds optional hide to system tray behaviour on closing and/or minimizing the main window. The settings have an option to enable or disable it in the general section. The tray icon has a small menu for closing the app or opening the window again, and it can be opened by clicking on the icon too.
Screenshots
https://imgur.com/a/1TVWBJp
https://imgur.com/a/xvBEqFe
Testing
Fully tested on Windows.
The closing behaviour has been adapted for Darwin but has not been tested.
Desktop
Additional context