Skip to content

How to make the wallpaper respect dark/light modeΒ #454

@My-Name-Is-Adam

Description

@My-Name-Is-Adam

I made a script to automatically change the background to match the system light/dark mode.

I thought I'd share how to achieve this here as I have seen a few people requesting this feature.
Show the file extensions in file explorer.
Copy the settings.json to the C:\ drive changing and add .light to the end of the file name - repeat this step and rename the other dark.

Open each file in Notepad.

Find the following line and make sure the dark file has the following, change the light file to say false.
"darkMode": true,

Download AutoHotKey and use the following script. Change your username to match your system.

^F1:: Process, Close, WinDynamicDesktop.exe Sleep, 1000 Run powershell Remove-Item -Path C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json Sleep, 6000 Run powershell Copy-Item "C:\settings.json.dark" -Destination "C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json" RegWrite, REG_DWORD, HKEY_CURRENT_USER\SOFTWARE\Stoic Joker's\T-Clock 2010\Clock, ForeColor, 16777215 Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force Sleep 1000 Run, C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\WinDynamicDesktop.exe return ^F2:: Process, Close, WinDynamicDesktop.exe Sleep, 1000 Run powershell Remove-Item -Path C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json Sleep, 6000 Run powershell Copy-Item "C:\settings.json.light" -Destination "C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\settings.json" RegWrite, REG_DWORD, HKEY_CURRENT_USER\SOFTWARE\Stoic Joker's\T-Clock 2010\Clock, ForeColor, 0 Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force Run powershell Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1 -Type Dword -Force Sleep, 10000 Run, C:\Users\adam_\AppData\Local\Programs\WinDynamicDesktop\WinDynamicDesktop.exe return

Now when you press Ctrl key and F1 it will change the system theme and the wallpaper to dark mode. Pressing Ctrl and F2 for the light system mode and wallpaper.

I need to improve the script as I don't want the Powershell windows to appear but this does the job.

The code above also changes the T-Clock text colour to white/black so it is readable when switching modes as it doesn't happen automatically so if you don't use this you can just remove it.

You can also use this with AutoDarkMode by replacing the two lines above Sleep, 1000 with SendInput, ^{9} - change the Hotkey to match the ones you have set up in the AutoDarkMode app.

I hope this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions