Skip to content

Instantly share code, notes, and snippets.

@rjlynch
Last active July 1, 2019 19:22
Show Gist options
  • Select an option

  • Save rjlynch/f0cc2cd55a4f71c84edc8af25f57afc8 to your computer and use it in GitHub Desktop.

Select an option

Save rjlynch/f0cc2cd55a4f71c84edc8af25f57afc8 to your computer and use it in GitHub Desktop.
wallpaper switcher macos

Wallpaper

My hacky terminal wallpaper switcher for macos.
Requires FZF https://github.com/junegunn/fzf
Assumes wallpapers are in /Library/Desktop Pictures

Demo

https://imgur.com/DFdR6WM

install

Just copy wallpaper.sh into a file in your path and change it's permissions to make it executable.
eg:
curl "https://gist.githubusercontent.com/rjlynch/f0cc2cd55a4f71c84edc8af25f57afc8/raw/e559ac7d7a2a68c5c11aa259009e2a9c36e9dfe4/wallpaper.sh" > /usr/local/bin/wallpaper && chmod 700 /usr/local/bin/wallpaper

#! /usr/bin/env bash
function wallpaper () {
local wallpapers_path="/Library/Desktop Pictures"
local filename="$(ls "$wallpapers_path" | fzf)"
if [[ -z "$filename" ]]; then
echo "No file to attach"
exit 1
fi
local file="$wallpapers_path/$filename"
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$file\""
}
wallpaper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment