Skip to content

Instantly share code, notes, and snippets.

@UndarkAido
Last active March 25, 2016 06:08
Show Gist options
  • Save UndarkAido/ef57bd82996af922fa1b to your computer and use it in GitHub Desktop.
Save UndarkAido/ef57bd82996af922fa1b to your computer and use it in GitHub Desktop.
#!/bin/bash
#set -x
################################################## ############################
## Enable the compiz wallpaper plugin and manually set 4 wallpapers in ccsm ##
## before running this script ##
################################################## ############################
# Adapted from http://ubuntuforums.org/archive/index.php/t-2268186.html
################################################## ############################
directory="/media/Crossover/Wallpapers" # set your wallpaper directory
find "$directory" -type f -iname '*.jpg' -or -iname '*.jpeg' -or -iname '*.png' | shuf -n 9 > ~/.9walls # searches recursively
## use this to set a permanent image on desk1 to whatever you have selected in Appearances
## or to use with xplanetfx which alternates between ~/.xplanetFX/output/xplanetFX1.png and ~/.xplanetFX/output/xplanetFX2.png
#desk1="$(dconf read /org/gnome/desktop/background/picture-uri | cut -c 9- | tr -d "'")" # comment for random image
desk1="$(awk 'NR==1' ~/.9walls)" # uncomment for random image
desk2="$(awk 'NR==2' ~/.9walls)"
desk3="$(awk 'NR==3' ~/.9walls)"
desk4="$(awk 'NR==4' ~/.9walls)"
desk5="$(awk 'NR==5' ~/.9walls)"
desk6="$(awk 'NR==6' ~/.9walls)"
desk7="$(awk 'NR==7' ~/.9walls)"
desk8="$(awk 'NR==8' ~/.9walls)"
desk9="$(awk 'NR==9' ~/.9walls)"
## sets the 4 desktop images in the compiz wallpaper plugin
dconf write /org/compiz/profiles/unity/plugins/wallpaper/bg-image "['$desk1', '$desk2', '$desk3', '$desk4', '$desk5', '$desk6', '$desk7', '$desk8', '$desk9']"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment