-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
windows/app theme does not referesh the system after switching! #427
Comments
Can you check if the same behavior happens when you manually switch between light and dark themes in Windows 11 Personalization settings? If so, this is a bug in Windows rather than WDD. |
we checked this me and the other app developer, the problem is from your side(maybe the scripts or something) |
For me, this issue occurs on the latest Windows 11 Beta build (22593.1) with WDD 5.1. I tick "Enable Night Mode," apps such as browsers switch to dark as expected but the system UI and the background remains light. |
The same problem have bothered me for some time. |
It seems like Microsoft has changed the behavior of the night mode shifting actions in recent preview versions. |
The problem is still relevant in the latest version of windows 22621.1105 |
My system: Version Windows 11 Pro Workstation (Insider Preview) I checked the registry mentioned in the script. Things come strange. Here's how it comes:
I guess that the |
Looking for a solution. |
I have the same issue.
Pull request for the mouse script: You just need to know which API needs to be called to update these values. Maybe use Process Monitor v3.92? |
Looks like the AutoDarkMode team had the same issue and managed to get it working by updating the colorization: AutoDarkMode/Windows-Auto-Night-Mode#567 |
It seems like Microsoft has made theme switching more difficult in Windows 11, so there is no longer a simple way to do it from a PowerShell script. I would suggest using AutoDarkMode alongside WinDynamicDesktop if you want both features - dynamic wallpaper and automatic dark theme. |
This solution seems less elegant since one has to run one more app in the background for that. Maybe I can try to fix this when I have more spare time but that will be months later. |
Prior to WinDD v4, there were built-in options to change app/system theme. I removed them since the purpose of the core app is only to display dynamic wallpapers, and moved them into separate PowerShell scripts. Contributions to the WDD-scripts repo are welcome to fix the behavior of the Change App Theme and Change System Theme scripts 🙂 |
@bigplayer-ai Honestly maintaining a functioning theme switch is nightmare territory. It almost never works reliably and you're chasing behavior that often breaks the entire windows UI for no apparent reason. I would assume maintaining WDD by itself is already enough work as is (and so is ADM as a matter of fact)
@leostudiooo It's already possible to call ADM via CLI, perform the operations you desire and then shut it down again, so you get no background app. You can also hide the tray icon so you won't even know its running temporarily. As far as elegance is concerned. Automatic theme switching is absolutely not approved by Microsoft and hacks to achieve said theme switching cannot be elegant by design. We're not even sure that ADM will work in the future. |
Can you explain more about ADM clis?On 9 Mar 2023, at 14:31, Sam ***@***.***> wrote:
If that’s the case I think WDD should have a built in options to change dark/light theme switch that uses the way mentioned
@bigplayer-ai Honestly maintaining a functioning theme switch is nightmare territory. It almost never works reliably and you're chasing behavior that often breaks the entire windows UI for no apparent reason.
I would assume maintaining WDD by itself is already enough work as is (and so is ADM as a matter of fact)
This solution seems less elegant since one has to run one more app in the background for that. Maybe I can try to fix this when I have more spare time but that will be months late
@leostudiooo It's already possible to call ADM via CLI, perform the operations you desire and then shut it down again, so you get no background app. You can also hide the tray icon so you won't even know its running temporarily.
Yes you have to configure ADM a bit, but it should work.
As far as elegance is concerned. Automatic theme switching is absolutely not approved by Microsoft and hacks to achieve said theme switching cannot be elegant by design. We're not even sure that ADM will work in the future.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
We have documentation available here: You would call something like this in WDD:
while having automatic switching and tray icon disabled in the AutoDarkMode settings, which can be configured using the app. |
Updating colorization works, but is done for a different reason, namely updating the titlebars/colors. |
@Spiritreader |
Use windows theme mode, configure two themes with different mouse cursors, then set the "ignore background" flag. If you have further questions feel free to use the discussions tab in the Auto dark Mode repository to keep the discussion in this issue on topic. |
I'm sadly not proficient in powershell, but yes, it's probably related to escaping arguments and using the correct call syntax I would assume. I would also recommend specifying a custom timeout here:
There was a bug in older versions (including current stable, so ensure you're using the latest beta) that caused problems if it was omitted with the launch service argument present. |
I found the correct syntax for PowerShell 7: $params = @("--light", "10", "--and-launch-service")
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" @params
$params2 = @("--exit")
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" @params2 What does the custom timeout do, and why do you recommend it (I thought the timeout value is a parameter that you can use with Auto Dark Mode to specify how long you want to switch your theme for.)? Why should I use it? |
The custom timeout specifies how long the shell waits for the ADM service to respond. It's to ensure compatibility as mentioned before. Some older versions don't support the In your case it doesn't really matter if you use |
Actually it does differ. If you force night mode while using non forced dark mode. The theme won't switch if you set it for different time. # Use a ternary operator to assign different values to $params based on $nightMode
$params = $nightMode ? @("--force-dark", "10", "--and-launch-service") : @("light", "10", "--and-launch-service")
# Invoke AutoDarkModeShell.exe with $params
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" @params
# Invoke AutoDarkModeShell.exe with --exit
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" --exit |
No. If you have set up everything correctly, it doesn't matter if you use the force method or not. Please ensure that automatic switching is disabled in ADM and that your theme is configured correctly. Your snippet only generates I'm not involved with WDD. I merely reached out as courtesy for people that want to get theme switching to work alongside it without actually having to use the ADM background service. Which is technically not how the program is supposed to be used. My main focus lies with maintaining ADM. Good luck! |
Ok thanks, It seems working pretty well atm. Also, It helped me with my mouse scheme (less clutter). |
Sure thing, glad you like it! |
@Spiritreader Thanks for developing ADM ❤️ You are right, it's kind of a nightmare to maintain some features that are not approved by Microsoft 🙂 Setting a wallpaper across all virtual desktops is similar because it keeps breaking with new versions of Win11.
This is awesome for folks who want to use WinDD and ADM together. Would you approve of having a PowerShell script in the WDD-scripts repo that would invoke the ADM CLI to change theme? If so I can add one along with some documentation for how to set it up. |
@t1m0thyj Absolutely. I've been loosely following the whole virtual desktop fiasco and every time a new Windows build releases it's an "oh no" scenario where the question pops up what broke this time because they changed the import GUIDs again.
The easiest way still is to just run both apps simultaneously, we've made sure to include options such that other wallpaper tools don't cause collisions with ADM's theming engine.
Of course, go ahead! If you need more specific knowledge about the CLI than our doc on it provides, feel free to reach out. In case you would like a more tight integration, it's possible to send the CLI messages to ADM directly via a namedpipe C# API that we provide (although in that case starting ADM has to be handled via a Process class or similar). https://github.com/AutoDarkMode/Windows-Auto-Night-Mode/blob/master/AutoDarkModeComms/PipeClient.cs class MessageHandler
{
public static IMessageClient Client { get; } = new PipeClient();
} ApiResponse result = ApiResponse.FromString(MessageHandler.Client.SendMessageAndGetReply(Command.Dark)); The extra class is not required, Something like this works too: IMessageClient Client = new PipeClient();
ApiResponse result = ApiResponse.FromString(Client.SendMessageAndGetReply(Command.Dark)); |
Hello everyone and thank for your messages. param (
[Parameter(Mandatory=$true)][int]$daySegment2, # 0 = Day, 1 = Night
[Parameter(Mandatory=$true)][int]$daySegment4, # -1 = N/A, 0 = Sunrise, 1 = Day, 2 = Sunset, 3 = Night
[Parameter(Mandatory=$true)][bool]$nightMode, # True if night mode is enabled
[Parameter(Mandatory=$false)][string]$imagePath # Path to current wallpaper image
)
# Use a ternary operator to assign different values to $params based on $nightMode
$params = $nightMode ? @("--force-dark", "10", "--and-launch-service") : @("--force-light", "10", "--and-launch-service")
# Invoke AutoDarkModeShell.exe with $params
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" @params
# Invoke AutoDarkModeShell.exe with --exit
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" --exit |
Works perfectly on my ARM64 device but throws the following error on my desktop:
Tried reinstalling both apps but no luck. |
Looks like your desktop doesn't have Powershell 7 or newer, the ternary operator didn't exist before that. in PS. Maybe that could be it. |
Hello, you can use this script that should works : param (
[Parameter(Mandatory = $true)][int]$daySegment2, # 0 = Day, 1 = Night
[Parameter(Mandatory = $true)][int]$daySegment4, # -1 = N/A, 0 = Sunrise, 1 = Day, 2 = Sunset, 3 = Night
[Parameter(Mandatory = $true)][bool]$nightMode, # True if night mode is enabled
[Parameter(Mandatory = $false)][string]$imagePath # Path to current wallpaper image
)
$dark = If ($daySegment2 -eq 1) { "--force-dark" } Else { "--force-light" }
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" $dark 10 --and-launch-service
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" --exit |
Thank you! that worked! |
TLDR; Windows 11 Settings>Personalisation>Colours>Choose your mode> Choose custom here rather than just light or dark for both seems to have fixed the inconsistent updating of system colours for me. I'm using the powershell scripts with the desktop version to switch between light/dark mode as well as update the wallpaper. I noticed app theme would update but not always the system theme, taskbar would still be old colour mode. After killing process explorer.exe and starting again the system theme would update. Not an ideal solution. Seeing as both app and system themes are updated with two separate commands I thought I'd try setting colour mode to custom just in case there is a state bug with using powershell commands. Seems to have worked so far it's been two days and system colour theme is updating. Not sure if this is exactly related to OP or subsequent thread but thought I'd shave a workaround for a similar problem I was having. |
Getting this problem again with the new update, even after changing the personalization options to custom. Does anyone know how to get the old AutoDarkMode script working for the new engine? |
Here's an updated version of the AutoDarkMode script in #427 (comment): $params = $Input | ConvertFrom-Json
$dark = If ($params.daySegment2 -eq 1) { "--force-dark" } Else { "--force-light" }
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" $dark 10 --and-launch-service
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" --exit |
Thank you! This worked perfectly. |
Here is an updated AutoDarkMode script that accounts for manual dark/light mode settings. Ensure that WDD runs in admin mode, which can be set up using Task Scheduler at login. # Convert the input from JSON
$params = $Input | ConvertFrom-Json
# Define the $dark variable based on the themeMode and daySegment2
$dark = switch ($params.themeMode) {
0 { # Automatic mode
if ($params.daySegment2 -eq 1) { "--force-dark" } else { "--force-light" }
}
1 { "--force-light" } # Light mode
2 { "--force-dark" } # Dark mode
default { "--force-light" } # Default to light mode if anything else
}
# Launch AutoDarkModeShell with the determined mode
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" $dark 10 --and-launch-service
# Add a delay before exiting (e.g., 10 seconds)
Start-Sleep -Seconds 10
# Exit the AutoDarkModeShell
& "C:\Program Files (x86)\AutoDarkMode\AutoDarkModeShell.exe" --exit
|
Steps to Reproduce:
1.change light to dark mode
2. pressing start menu shows whitetext on white surface+app that needs to be updated doesnot referesh unless refreshed manuallY!
Are you using the Microsoft Store version of WDD?: No
The text was updated successfully, but these errors were encountered: