-
-
Notifications
You must be signed in to change notification settings - Fork 917
fix(controls): Fix theme and accent color reset after Windows session unlock #1608
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
base: main
Are you sure you want to change the base?
Conversation
- Add session switch event handling to restore theme and accent color after unlock - Store current theme and accent color before session lock - Ignore WM_WININICHANGE messages during unlock restore period (5 seconds) - Preserve stored theme when it differs from system theme - Optimize code by removing unnecessary operations and using switch expressions - Remove debug output statements
|
Thanks for the detailed PR! I've reviewed the changes and have some thoughts on the approach. 1. Current behavior might be intentional 2. Flexibility concern 3. Simpler alternative if needed
Question: Just my thoughts - what do you think about this approach? |
I was one of the original people that complained about this issue. I do believe that this is an actual issue instead of expected behavior. When I manually select dark mode (not follow system theme) there would be times when the application would randomly change back to white after the computer was idling for a while or even when accidentally activating the voice access when trying to take a screenshot (CTRL + Win + S). Idk, but to me there is no way on earth that that is an expected/desired behavior. |
|
Hi @[username], after careful consideration, I believe we should address the root cause rather than applying temporary fixes that may obscure the underlying issue. The Core Problem: A More Targeted Approach (for your consideration):
...which handle application theme colors and main window background, we might only need to listen to three specific messages instead:
Potential benefits:
These are just my thoughts for your reference—hopefully they can provide some useful insight for your work on this PR. |
|
Hi @Devin-goBILDA , I took some time drafting a new response and didn't notice your message earlier—my apologies. Regarding the issue you mentioned where the application randomly switches theme colors when Ctrl + Win + S activates voice control, have you tried disabling the theme watcher by commenting out any calls to |
|
My apologies—I’m not very familiar with PR communication workflows, so I used AI to help translate and polish my message, and I forgot to update the placeholder "@[username]". Yes, I have just reproduced the issue described by @Devin-goBILDA where pressing Ctrl + Win + S (activating voice control) causes the application theme to reset. The approach I mentioned in my second reply does avoid this problem: if (msg == (int)PInvoke.WM_DWMCOLORIZATIONCOLORCHANGED ||
msg == (int)PInvoke.WM_THEMECHANGED ||
msg == (int)PInvoke.WM_SYSCOLORCHANGE)
//if (msg == (int)PInvoke.WM_WININICHANGE)
{
UpdateObservedWindow(hWnd);
} |
|
If you are able to reproduce the lock screen → black screen → login → theme reset issue, could you please try whether the approach I suggested resolves it? I haven't been able to reproduce this problem under any test conditions on my end… |
|
@apachezy |
This reverts commit 9b61717.
|
@apachezy |
|
@apachezy |
|
@Koichi-Kobayashi 👍nice! |
|
Could you please update the PR description to include: These issues will be automatically closed when the PR is merged.👌 |
Nuklon
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.
This is OK to merge.
Pull request type
What is the current behavior?
Issue Number: #1467 #1267
What is the new behavior?
The code from the initial pull request is no longer needed, so I reverted it.
WM_DWMCOLORIZATIONCOLORCHANGED
Meaning: Sent when the DWM (Desktop Window Manager) color settings change
Timing: When Windows accent colors or DWM color settings change
Purpose: Detect accent color changes
WM_THEMECHANGED
Meaning: Sent when the theme changes
Timing: When switching between light/dark mode or changing the Windows theme
Purpose: Detect theme changes
WM_SYSCOLORCHANGE
Meaning: Sent when system colors change
Timing: When system colors (window background, text, etc.) change
Purpose: Detect system color changes
Other information
Before locking

After unlocking
