-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Option to toggle the system tray icon #23220
base: main
Are you sure you want to change the base?
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. |
@@ -2870,4 +2870,10 @@ Activate by holding the key for the character you want to add an accent to, then | |||
<data name="TextExtractor_Languages.Header" xml:space="preserve"> | |||
<value>Preferred language</value> | |||
</data> | |||
<data name="GeneralPage_HideSystemTrayIcon.Description" xml:space="preserve"> | |||
<value>You will not be able to access PowerToys settings once you do this.</value> |
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.
When it's said like this, that sounds very... Let's say unlogical.
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 wrote that as a temporary comment until I could implement the fix to launching PowerToys as a duplicate instance correctly launching settings. I will be pushing that here soon with a more descriptive message.
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. |
Hi @BLM16 , indeed with recent changes to PowerToys, I think this PR can be reviewed. |
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 think the naming of this setting is not inline with what Windows normally uses.
I'd assume that in the UI we'd show a CheckBox
or ToggleSwitch
with a label saying something like "Show PowerToys icon in system tray", and this would be turned on by default (like it always was), and can now be turned off.
This is inline with how W11 Settings does this:
cc @Jay-o-Way @trajano as a follow-up to your earlier comment
@BLM16 Do you mind posting a few screenshots of what the UI changes look like? |
@@ -145,6 +146,10 @@ | |||
x:Uid="Feedback_NavViewItem" | |||
Icon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}" | |||
Tapped="FeedbackItem_Tapped" /> | |||
<NavigationViewItem |
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.
@crutkas @ethan-fang-MS Not a fan of this as we're trying to declutter the NavView. I also don't have any other suggestions - any ideas from your side?
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.
This would be an ideal use of a File ribbon menu, however that doesn't exist unfortunately. I am open to any other ideas, but this was the best I could come up with (beyond placing the exit option randomly on one specific page, but that feels awkward and not easy to find).
At the moment, this hides the icon making the settings window inaccessible without first modifying the general `settings.json` file.
761ae41
to
9690c64
Compare
9690c64
to
eab7772
Compare
It is not possible to do either when the icon is hidden via shortcuts or anything, however another PR I made fixed the singleton issue, so running PowerToys again binds to the active process and people can exit/bug report from the UI or re-enable the icon.
I rebased this onto main and resolved the conflicts. For some reason I cannot build this locally as WinRT is using a different version (though VS says I have the correct version and SDKs installed). Any ideas on this? Does it work for you? I cannot see all the issues as the build exits early in places due to said error. |
Is anyone able to build and test this? I am still trying to diagnose my configuration/version issues and cannot build this to test if it functions as expected. |
Hi @BLM16 , |
In the screenshot it shows
|
if (json::has(general_configs, L"hide_tray_icon", json::JsonValueType::Boolean)) | ||
{ | ||
hide_tray_icon = general_configs.GetNamedBoolean(L"hide_tray_icon"); | ||
// Update tray icon visibility when setting is toggled | ||
set_tray_icon_visible(!hide_tray_icon); | ||
} | ||
|
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.
The addition of hide_tray_icon in apply_general_settings is well-implemented, and toggling the tray icon visibility based on this setting improves user control. Consider adding a brief comment to explain the specific use case or behavior, as it may help maintainers understand its purpose during future updates.
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.
Copilot reviewed 6 out of 16 changed files in this pull request and generated no comments.
Files not reviewed (10)
- src/runner/Resources.resx: Language not supported
- src/runner/general_settings.cpp: Language not supported
- src/runner/general_settings.h: Language not supported
- src/runner/main.cpp: Language not supported
- src/runner/resource.base.h: Language not supported
- src/runner/tray_icon.cpp: Language not supported
- src/runner/tray_icon.h: Language not supported
- src/settings-ui/Settings.UI/SettingsXAML/Views/GeneralPage.xaml: Language not supported
- src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml: Language not supported
- src/settings-ui/Settings.UI/Strings/en-us/Resources.resw: Language not supported
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'
dwState
anddwStateMask
and only hides the icon from view. This does not impact the functionality of the modules or settings.Validation Steps Performed
Todo