Return to Snippet

Revision: 10978
at January 20, 2009 11:50 by webonomic


Initial Code
-> 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

Initial URL
http://jaredprins.squarespace.com/ubducted/2009/1/19/unique-background-wallpapers-for-workspaces-on-ubuntu-linux.html

Initial Description
Bash shell scripts to control wallpaper backgrounds when switching between Ubuntu workspaces. (Other distributions can use it too).

Take the below 2 scripts to make 2 separate files.  Use gconf-editor to attach keybindings to run_command_1 and run_command_2.  Set command_1 and command_2 to point to the appropriate files.  

See the URL for more details.

Initial Title
Unique Background Wallpapers for Workspaces on Linux

Initial Tags
linux

Initial Language
Bash