AutoDarkMode / Windows-Auto-Night-Mode

Automatically switches between the dark and light theme of Windows 10 and Windows 11
GNU General Public License v3.0
7.53k stars 266 forks source link

Auto-Dark mode doesn't switch if sunrise/sunset occurs while computer is asleep #500

Closed ddiggles closed 2 years ago

ddiggles commented 2 years ago

Description

Hello!

Auto Dark Mode works fine on my desktop. If I shut my computer down after sunset, with ADM on, then turn my computer on in the morning after sunrise, as soon as ADM loads, it switches to light mode.

On my new laptop (Lenovo Slim 7 Pro X), if sunset occurs while the computer is asleep (lid shut), ADM does not switch, and then I have to manually toggle it. This same behavior is happening with Windows Night Light. I'm guessing they're related, because both are using sunrise/sunset to do their thing.

Not sure how to troubleshoot this. Any suggestions are appreciated.

Expected Behavior

If laptop is asleep during a trigger time (sunset), ADM does not switch when I wake the laptop, like I believe it should.

I have to go in and do it manually.

Log Data

service.log config yaml.txt

Operating System

Windows 11 Pro 22000.918

Commit Hash and Version

Screenshots

No response

jelly-mazic commented 2 years ago

i have same problem too,Lenovo yaga 13s AMD windows11。

Spiritreader commented 2 years ago

I assume the logs you provided are for the desktop as I can't see any system resume events there.

Hm unfortunately I can't really see anything wrong with the logs. As soon as ADM starts, it fires all events and changes the requested regkeys. ADM seems to be doing what it's supposed to.

Maybe we can get this to work still:

First, please update to the latet beta version and try to use theme switch with this flag enabled: image

BKLTS commented 2 years ago

I assume the logs you provided are for the desktop as I can't see any system resume events there.

Hm unfortunately I can't really see anything wrong with the logs. As soon as ADM starts, it fires all events and changes the requested regkeys. ADM seems to be doing what it's supposed to.

Maybe we can get this to work still:

First, please update to the latet beta version and try to use theme switch with this flag enabled: image

Hello, I also encountered this problem, when I turn off the computer in dark mode, turn on the computer at noon the next day, ADM will not turn my computer into light mode after self-starting. Even if I manually turn ADM off and on again, it still doesn't automatically change the computer to light mode.

BKLTS commented 2 years ago

I assume the logs you provided are for the desktop as I can't see any system resume events there.

Hm unfortunately I can't really see anything wrong with the logs. As soon as ADM starts, it fires all events and changes the requested regkeys. ADM seems to be doing what it's supposed to.

Maybe we can get this to work still:

First, please update to the latet beta version and try to use theme switch with this flag enabled: image

I tried to use theme switch with the flag enabled, it still has this problem.

Spiritreader commented 2 years ago

I assume the logs you provided are for the desktop as I can't see any system resume events there. Hm unfortunately I can't really see anything wrong with the logs. As soon as ADM starts, it fires all events and changes the requested regkeys. ADM seems to be doing what it's supposed to. Maybe we can get this to work still: First, please update to the latet beta version and try to use theme switch with this flag enabled: image

I tried to use theme switch with the flag enabled, it still has this problem.

Could you upload your logs please so I can take a look?

SettingDust commented 2 years ago

It fine in prev version. But not now. It's says the theme switched. But seems failed

2022-09-29 09:13:47 | Info | PowerEventHandler.SystemEvents_PowerModeChanged: system resuming from suspended state, refreshing theme 
2022-09-29 09:13:49 | Info | AppsSwitchThemeFile.HandleSwitch: update info - previous: Dark, now: Light, mode: Switch 
2022-09-29 09:13:49 | Info | SystemSwitchThemeFile.SwitchSystemTheme: update info - previous: Dark/Accent, now: Light/NoAccent, mode: Switch, accent: yes 
2022-09-29 09:13:49 | Error | ThemeManager.UpdateTheme: couldn't apply managed theme file:  ArgumentOutOfRangeException > Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') > Void ThrowArgumentOutOfRange_IndexException()
2022-09-29 09:13:49 | Info | ThemeManager.UpdateTheme: light theme switch performed, source: SystemResume 
Spiritreader commented 2 years ago

It fine in prev version. But not now. It's says the theme switched. But seems failed

2022-09-29 09:13:47 | Info | PowerEventHandler.SystemEvents_PowerModeChanged: system resuming from suspended state, refreshing theme 
2022-09-29 09:13:49 | Info | AppsSwitchThemeFile.HandleSwitch: update info - previous: Dark, now: Light, mode: Switch 
2022-09-29 09:13:49 | Info | SystemSwitchThemeFile.SwitchSystemTheme: update info - previous: Dark/Accent, now: Light/NoAccent, mode: Switch, accent: yes 
2022-09-29 09:13:49 | Error | ThemeManager.UpdateTheme: couldn't apply managed theme file:  ArgumentOutOfRangeException > Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') > Void ThrowArgumentOutOfRange_IndexException()
2022-09-29 09:13:49 | Info | ThemeManager.UpdateTheme: light theme switch performed, source: SystemResume 

Hmm about that, it seems like a section in the theme file can't be written to. Please update to Beta 10.3.0.4, run again and re-post the logs. I've added better exception handling for that section.

Spiritreader commented 2 years ago

Windows 11 does no longer allow theme switching when the session is locked. I've addressed this by moving the switch to the session unlock event. Win 10 still works the same for now.

Spiritreader commented 2 years ago

should be resolved since Beta 10.1.0.38. Feel free to re-open if it still occurs.