/ Published in: Bash
                    
                                        
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.
                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.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
-> 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
Comments
 Subscribe to comments
                    Subscribe to comments
                
                