-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwitchDarkModeWindows.ahk
21 lines (21 loc) · 1.17 KB
/
SwitchDarkModeWindows.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#SingleInstance Force ; Allow only one instance off this app]
NumpadEnter::
; read the System lightmode from the registry
RegRead,L_LightMode,HKCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize,SystemUsesLightTheme
If L_LightMode { ; if the mode was Light
; write both system end App lightmode to the registry
RegWrite,Reg_Dword,HKCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize,SystemUsesLightTheme,0
RegWrite,Reg_Dword,HKCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize,AppsUseLightTheme ,0
}
else { ; if the mode was dark
; write both system end App lightmode to the registry
RegWrite,Reg_Dword,HKCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize,SystemUsesLightTheme,1
RegWrite,Reg_Dword,HKCU,SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize,AppsUseLightTheme ,1
}
; tell the system it needs to refresh the user settings
run, RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1 True
; reload explorer.exe to fix UI for 22h2
RunWait taskkill /F /IM explorer.exe
Sleep, 2000
Run explorer.exe
Return