-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Runner TrayIcon: Monochrome icon should adapt to windows theme instead of the app theme #44931
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
This comment has been minimized.
This comment has been minimized.
|
@niels9001 Does this make more sense compared to our monochrome icon listen to app theme? |
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.
Pull request overview
This pull request changes the Runner's tray icon to adapt to the Windows system theme instead of the PowerToys application theme. This ensures the monochrome tray icon has appropriate contrast regardless of whether the user's system-wide theme differs from their PowerToys app theme.
Changes:
- Modified tray icon initialization and theme change handlers to use
ThemeHelpers::GetSystemTheme()instead oftheme_listener.AppTheme - Extended
ThemeListenerclass to track both app and system themes separately with dedicated handlers - Added iterator validation check in
DelChangedHandlerto prevent undefined behavior
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/runner/tray_icon.cpp | Changed tray icon theme detection from app theme to system theme, registered handler for system theme changes |
| src/common/Themes/theme_listener.h | Added SystemTheme member and separate handler methods for app/system theme changes |
| src/common/Themes/theme_listener.cpp | Implemented separate handler tracking for app/system themes, added iterator validation, improved loop counter types |
| .github/actions/spell-check/expect.txt | Removed unused spell-check entries and normalized casing |
src/common/Themes/theme_listener.cpp
Outdated
| for (size_t i = 0; i < handles.size(); i++) | ||
| { | ||
| handles[i](); | ||
| } | ||
|
|
||
| // Call app theme specific handlers | ||
| if (appThemeChanged) | ||
| { | ||
| for (size_t i = 0; i < appThemeHandles.size(); i++) | ||
| { | ||
| appThemeHandles[i](); | ||
| } | ||
| } | ||
|
|
||
| // Call system theme specific handlers | ||
| if (systemThemeChanged) | ||
| { | ||
| for (size_t i = 0; i < systemThemeHandles.size(); i++) | ||
| { | ||
| systemThemeHandles[i](); | ||
| } | ||
| } |
Copilot
AI
Jan 22, 2026
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 handler vectors (handles, appThemeHandles, systemThemeHandles) are being accessed from both the background thread (_checkTheme) and the main thread (Add/Del methods) without any synchronization. This creates a race condition where handlers could be added or removed while the background thread is iterating over the vectors, potentially causing crashes or undefined behavior. Consider adding a mutex to protect access to these vectors.
YES! It should not listen to app theme at all, but only to system theme.. if the taskbar is dark, it should render white. if it's light, it should render black, and can totally ignore how PT is themed |
…d of the app theme (#44931) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request As title <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] Closes: #44891 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed ============ System light + App Light <img width="903" height="239" alt="image" src="https://github.com/user-attachments/assets/581606fb-99b5-4df9-a520-545a0c04676c" /> ============ System Light + App Dark <img width="991" height="239" alt="image" src="https://github.com/user-attachments/assets/822009e9-57cf-452b-b3aa-f1cbc25883f8" /> ============ System Dark + App Light <img width="932" height="236" alt="image" src="https://github.com/user-attachments/assets/98a56d48-31f0-4f75-95a4-8c7dc83c3866" /> ============ System Dark + App Dark <img width="903" height="236" alt="image" src="https://github.com/user-attachments/assets/2500a0d5-6b27-403e-89b4-69b7d3b91e79" /> ============
…d of the app theme (#44931) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request As title <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] Closes: #44891 <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed ============ System light + App Light <img width="903" height="239" alt="image" src="https://github.com/user-attachments/assets/581606fb-99b5-4df9-a520-545a0c04676c" /> ============ System Light + App Dark <img width="991" height="239" alt="image" src="https://github.com/user-attachments/assets/822009e9-57cf-452b-b3aa-f1cbc25883f8" /> ============ System Dark + App Light <img width="932" height="236" alt="image" src="https://github.com/user-attachments/assets/98a56d48-31f0-4f75-95a4-8c7dc83c3866" /> ============ System Dark + App Dark <img width="903" height="236" alt="image" src="https://github.com/user-attachments/assets/2500a0d5-6b27-403e-89b4-69b7d3b91e79" /> ============
Summary of the Pull Request
As title
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
============ System light + App Light




============ System Light + App Dark
============ System Dark + App Light
============ System Dark + App Dark