Windows-Auto-Night-Mode icon indicating copy to clipboard operation
Windows-Auto-Night-Mode copied to clipboard

PowerShell script doesn't consistently execute when theme is toggled

Open richardhttps opened this issue 8 months ago • 2 comments
trafficstars

Description

Issue: The script sometimes executes and other times it doesn't.

  1. There are no issues with the PowerShell script itself.
  2. 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:

  1. The first logs the script executing
  2. 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

richardhttps avatar Mar 12 '25 08:03 richardhttps

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!

Spiritreader avatar Apr 14 '25 18:04 Spiritreader

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.

erosen03 avatar Jun 04 '25 14:06 erosen03

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

Spiritreader avatar Sep 06 '25 14:09 Spiritreader

Is still a problem now?

ChenYiLins avatar Oct 25 '25 06:10 ChenYiLins

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

erosen03 avatar Oct 27 '25 01:10 erosen03