Sander's Blurbs

Menu

Syncing Wallpaper Images Spoon

As a macOS user with a multi monitor setup and a laptop I frequently switch between 1 to 3 screens. I use task related spaces (general, coding, organisation, social) and to reinforce this habit I installed some Unsplash wallpaper images relating to the task.

In some undefined situations I lose the wallpaper image on certain screens on certain desktops (I have already disabled reordering and removing spaces) but dragging wallpapers across multiple screens on multiple spaces is too much work; and why not see if this can be automated.

Thanks to Hammerspoon and a few minutes time you can benefit from my script:

-- SYNC WALLPAPER --
function sync_wallpaper()
    wp = hs.screen.primaryScreen():desktopImageURL()
    for index,screen in ipairs(hs.screen.allScreens()) do
        if screen:desktopImageURL() ~= wp then
            print('Syncing Wallpaper')
            screen:desktopImageURL(wp)
        end
    end
end

hs.spaces.watcher.new(sync_wallpaper):start()
-- /SYNC WALLPAPER --

Add this to your .hammerspoon/init.lua and switch spaces to sync wallpapers to all screens on that space!

By the way

I’m using the following wallpapers: