Skip to content

Instantly share code, notes, and snippets.

@zuzkins
Created June 22, 2011 11:06
Show Gist options
  • Save zuzkins/1039883 to your computer and use it in GitHub Desktop.
Save zuzkins/1039883 to your computer and use it in GitHub Desktop.
My once lost now found wallpaper changing script for GNOME like desktops (works in Unity too)
#!/bin/bash
export $(xargs -n 1 -0 echo </proc/$(pidof gnome-session)/environ | grep -Z DBUS_SESSION_BUS_ADDRESS=)
#DISPLAY=:0
WALLPAPERS="BIG_WALLPAPER_COLLECTION_DIR"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
/usr/bin/gconftool-2 -t string -s "/desktop/gnome/background/picture_filename" "$WALLPAPERS/${ALIST[$number]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment