Windows-Auto-Night-Mode
Windows-Auto-Night-Mode copied to clipboard
PowerShell script doesn't consistently execute when theme is toggled
Description
Issue: The script sometimes executes and other times it doesn't.
- There are no issues with the PowerShell script itself.
- I'm using only one script for debug.
Below are the relevant log sections from the app's service.log log file, split into two parts that represent two theme toggle instances:
- The first logs the script executing
- The second doesn't log any attempt at executing the script
Log Data
Attached service.log scripts.yaml.txt
Commit Hash, Version and Windows Build
- Commit:
5922db4 - Service/App:
10.4.2.29 - Updater:
3.1.6 - Shell:
1.3.3.0 - .Net:
8.0.0 - Windows:
26100.3476 - Arch:
X64
Screenshots / Videos
No response
I think I figured out the issue. When a script fails, the theme state is not updated, which causes the scripting engine to no longer trigger on either light or dark, depending on where the initial error occurred.
Thanks for reporting!
The behavior I noticed is that the scripts only seem to execute when the theme is toggled while the Auto Dark Mode settings app is open.
Auto Dark Mode settings app is open.
The ADM app itself has no logic for manipulting script execution, it can only turn the entire feature off or on. This issue should be resolved in the latest beta branch, if not, please enable trace logs and post another service.log export
Is still a problem now?
Is still a problem now?
Sadly ADM is even less reliable in the latest release. Not only do scripts not run, but now the task bar color mode does not change reliably. Sometimes it changes, sometimes it doesn't, and sometimes it gets corrupted.
I've switched from ADM to the Light Switch component in Microsoft PowerToys (https://learn.microsoft.com/en-us/windows/powertoys/, https://github.com/microsoft/PowerToys). Light Switch is not as feature-rich as ADM, but it is very fast and reliable.
My ADM version info:
- Commit:
5678573e - Service/App:
11.0.0.54 - Updater:
4.0.3 - Shell:
1.3.3.0 - .Net:
9.0.8 - Windows:
26200.6901 - Arch:
X64