t1m0thyj / WinDynamicDesktop

Port of macOS Mojave Dynamic Desktop feature to Windows
https://windd.info
Mozilla Public License 2.0
4.42k stars 295 forks source link

accurate to one hour #583

Closed policx closed 6 months ago

policx commented 6 months ago

I have prepared 24 wallpapers, and I want to have corresponding wallpapers for each hour precisely. Can this function be added? Thank you very much.

t1m0thyj commented 6 months ago

If you want to schedule a new wallpaper for each hour of the day, this capability is built into Windows so you shouldn't need to install an app like WinDD. See https://superuser.com/a/1492746/517562

policx commented 6 months ago

Firstly, thank you very much for your answer. I ultimately chose to use powershell in conjunction with Windows scheduled tasks

# Define the wallpaper folder path
$wallpaperFolder = "D:\Images\jokul"

# Map the wallpaper filename with the hour number, simplifying the process by directly constructing the file path
$currentHour = Get-Date -Format "HH"
$wallpaperFile = "$wallpaperFolder\jokul_1$currentHour`.jpg"

# Check if the wallpaper file exists
if (-not (Test-Path $wallpaperFile)) {
    Write-Host "Wallpaper file not found: $($wallpaperFile)"
    exit
}

# Set the registry entry to change the wallpaper
$key = 'HKCU:\Control Panel\Desktop'
Set-ItemProperty -Path $key -Name Wallpaper -Value $wallpaperFile -Type String
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters

Write-Host "Wallpaper set successfully."
t1m0thyj commented 6 months ago

Thanks for sharing your solution 🙂 It should be helpful for anyone else who wants to have an hourly slideshow and finds the built-in capabilities of Windows lacking. Closing as completed, since this is outside the scope of planned features for WinDD.