-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Option to toggle the system tray icon #23220
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
Conversation
|
@microsoft-github-policy-service agree
|
|
@crutkas |
If PowerToys is running, launching the shortcut or the executable again finds the running system tray process and calls the settings command bound to it as if you right clicked and pressed it yourself. This is not working currently with my dev environment so I need to make sure this works before marking this not a draft. |
Unfortunately, that does not seem to be the case. P.S. 765 is dup'ed against #9526
@BLM16 Looks like this is much more complicated... |
I commented on this in #8277 and will be including that fix in my next push. My fix seems to have resolved the issue. |
|
There are numerous steps under #9526 that I would like to clarify.
What of these needs to be done? It seems to me like the setting itself along with how all other similar tools operate means documentation is self explanatory and theoretically shouldn't be needed. Does the bug report tool change need to be included in this feature? Should it not be migrated to a separate issue to be included in the roadmap? |
|
Thanks for asking me, but those things are beyond me 😇 I would point to @enricogior, but he fell off the grid... |
|
We're currently extending the system tray icon functionalities: #22408 Why is the change in this PR required? |
Hundreds of people have been asking for this? |
If the user wishes to use PowerToys as a service, their choice to remove the UI flyout is their own. There is already a link at the top of the settings menu (at least general settings) that links to the bug report. My thought was adding a button to the settings menu (would have to determine an ideal location if you have any ideas) that exits the program. If any functionality is desired once the icon has been hidden, it is simply a matter of relaunching PowerToys via the executable and disabling the hide icon setting. |
|
Please have in mind that the context menu entry in tray creates a bug report file and the link in settings app opens the GitHub page. I personally don't like this change because it brings us trouble. |
I think this is a product design issue overall actually, as different methods of reporting a bug feels inconsistent. Currently my bug report option from the context menu doesn't work (I am investigating this before creating an issue), however different methods of reporting bugs seems rather unmanageable and confusing. |
|
Oh by the way, is common that the menu itself has a "hide menu" item too 💡 |
That is one of the features I plan to implement soon. Which part of the context menu do you think should this go under? |
|
Above exit should be fine if you ask me |
|
As @jaimecbernardo called out, we are in the process of extending the system tray icon functionalities, #22408 to add in a quick launcher and super charge that menu. I do understand the user ask, but I feel like this is a partial solution to what was called out. Two big items is I don't think are actually addressed that the root issue did call out as needed implementation
|
Yes, and I think this is a great idea. A Win11 action center style flyout makes total sense for PowerToys. If people wish to run PT as a service (simply using the keyboard shortcuts for a few modules, or setting FancyZones once and leaving them) they can hide the PT icon with no repercussions (once the quit/bug report are fixed). I think giving people the option since they have asked is a good idea, leaving the decision up to them about whether or not they want it.
I cannot think of any other way to indicate PT is running, but that is the same as tons of other apps and services that are background processes. The icon will be visible by default, and it would only be hidden by people who don't want it. As such, the users who have hidden the icon know that the process is running (unless they quit or don't have run on start enabled). The use case for hiding the icon would be for people who aren't going to be frequently changing anything and simply wish for it to run in the background. As for quitting, I am going to add the ability to stop PT directly from the settings menu, which I think should be implemented regardless of whether this PR is merged. Add the ability to quit alongside all the other settings options where you would expect.
I think it is important to determine how bugs are to be reported firstly. There are 2 different methods where the icon shortcut launches the exe, but the link from settings redirects to the github issues. This should be standardized (unless I am unaware of the reason for this). The link from settings would report the bugs fine. In the case of reporting a bug regarding opening the settings window (this was mentioned in one of the related issues), the bug report tool being a standalone process would make more sense, where the user could simply launch the executable themselves as you mentioned. |
Do #7423 |
|
FYI can't seem to build. There's about 238 errors from the ImageResizer project. |
Interesting. That probably happened during my rebase merge to pull main in along with my commit. The build succeeded in CI though... Are you able to build the commit prior to integrating the context menu option? |
This is possible, however I again think this is out of the scope of this PR. Standardizing the bug report and fixing things like this should be integrated through a separate PR. |
|
Chiming in here, looks like the remaining open items were:
I've gone ahead and moved the shut down button to the title bar and out of the navigation view. I also added the report bug package creator to the General settings page under the Diagnostics & feedback section. Lastly, I flipped the logic from hide to show. All we need now is to get this up-to-date with main and @niels9001 will pop in and fix up the title bar height a bit. After this, let's get this reviewed and merged :) @BLM16 Thank you for your work here, we greatly appreciate it. This has been quite the popular ask and I'm hoping we can get this in for our next release |
|
Alrighty got the styling changes in from @niels9001, @vanzue can you get this synced up with main and help review and get this across the finish line? |
|
Sure, Happy to do that |
BLM16
left a 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.
I don't currently have the repo downloaded, so I just added the few minor changes as comments. This is untested, but theoretically this should fix the double-negative logic that arose from this being hide and being inverted to now being show.
| } | ||
| } | ||
|
|
||
| // Gets or sets a value indicating whether the PowerToys icon should be hidden in the system tray. |
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.
// Gets or sets a value indicating whether the PowerToys icon should be shown in the system tray.
src/settings-ui/Settings.UI.UnitTests/ViewModelTests/General.cs
Outdated
Show resolved
Hide resolved
src/settings-ui/Settings.UI.UnitTests/ViewModelTests/General.cs
Outdated
Show resolved
Hide resolved
src/runner/general_settings.cpp
Outdated
|
|
||
| // TODO: would be nice to get rid of these globals, since they're basically cached json settings | ||
| static std::wstring settings_theme = L"system"; | ||
| static bool show_tray_icon = false; |
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.
static bool show_tray_icon = true;Default is to show the icon.
|
Fix comments and built an installer locally and tested scenarios:
Looks pretty good from my side Only one left is when bug generating, there is no sign that it is generating, the button would not show there is any progress either. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* Added option to toggle the system tray icon At the moment, this hides the icon making the settings window inaccessible without first modifying the general `settings.json` file. * Use IPC messages to manage the tray icon settings * Fix launching second window binds to active settings process * Added context menu option to hide tray icon * Added Exit PT button to settings ui NavigationView.PaneFooter * Moved DllImports to NativeMethods.cs * Sentence case titles * Fix whitespace * Re-add exit icon to NavView * Re-added toggle switch to new UI * Fix build * Fix build after merge main * Fix the string to display * add shut down buttons * finish polish * fix string * Styling tweaks to titlebar and settingscards * fix comment * fix unit test * fix ut --------- Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: vanzue <vanzue@outlook.com> Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com> Co-authored-by: Niels Laute <niels.laute@live.nl>
* Added option to toggle the system tray icon At the moment, this hides the icon making the settings window inaccessible without first modifying the general `settings.json` file. * Use IPC messages to manage the tray icon settings * Fix launching second window binds to active settings process * Added context menu option to hide tray icon * Added Exit PT button to settings ui NavigationView.PaneFooter * Moved DllImports to NativeMethods.cs * Sentence case titles * Fix whitespace * Re-add exit icon to NavView * Re-added toggle switch to new UI * Fix build * Fix build after merge main * Fix the string to display * add shut down buttons * finish polish * fix string * Styling tweaks to titlebar and settingscards * fix comment * fix unit test * fix ut --------- Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: vanzue <vanzue@outlook.com> Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com> Co-authored-by: Niels Laute <niels.laute@live.nl>

Summary of the Pull Request
Adds the ability to toggle the system tray icon through a setting in the General tab.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Closes #9526 by contributing the functionality to hide the tray icon. This does not remove the icon process, which the modules depend on, but rather uses Windows'
dwStateanddwStateMaskand only hides the icon from view. This does not impact the functionality of the modules or settings.Validation Steps Performed
Todo