Unique Background Wallpapers for Workspaces on Linux

-> Save this to left_workspace.sh

#!/bin/bash
#left_workspace.sh

#get number of workspaces
ws=$(wmctrl -d | wc -l)

#current workspace index
cws=$(wmctrl -d | awk '/*/ {print $1}')

#work space on left
lws=$(($cws-1))

#wrap if required
if [ $lws = -1 ]; then
lws=$(($ws-1))
fi
echo $lws

#change to next workspace
wmctrl -s $lws

#set wallpaper depending on workspace number
case $lws in
("0") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/100.jpg;
;;
("1") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/200.jpg;
;;
("2") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/300.jpg;
;;
("3") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/400.jpg;
;;
#follow the above format to set as many desktops as you have specified in the workspace applet
esac

-> Save this next bit to right_workspace.sh

#!/bin/bash

#right_workspace.sh

#get number of workspaces
ws=$(wmctrl -d | wc -l)

#current workspace index
cws=$(wmctrl -d | awk '/*/ {print $1}')

#work space on right
rws=$(($cws+1))

#wrap if required
if [ $rws = $ws ]; then
rws=0
fi

#change to next workspace
wmctrl -s $rws

#set wallpaper depending on workspace number
case $rws in
("0") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/100.jpg;
;;
("1") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/200.jpg;
;;
("2") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/300.jpg;
;;
("3") gconftool -t string -s /desktop/gnome/background/picture_filename /home/jp/Pictures/400.jpg;
;;
#follow the above format to set as many desktops as you have specified in the workspace applet
esac

source

Comments are closed.