Skip to content

Instantly share code, notes, and snippets.

@rinx
Last active February 8, 2016 11:42
Show Gist options
  • Save rinx/eaa3f1455e1c092a99ec to your computer and use it in GitHub Desktop.
Save rinx/eaa3f1455e1c092a99ec to your computer and use it in GitHub Desktop.
iTerm2 wallpaper changer
#!/bin/sh
CMDNAME=`basename $0`
BASE_DIR=$(cd $(dirname $0);pwd)
image_list=(${BASE_DIR}/*.jpg)
numimglist=${#image_list[@]}
rannum=$(( $RANDOM % ${numimglist}))
image_path=${image_list[$rannum]}
osascript -e "tell application \"iTerm\"
set current_terminal to (current terminal)
tell current_terminal
set current_session to (current session)
tell current_session
set background image path to \"$image_path\"
end tell
end tell
end tell"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment