By Ben Nitkin on
As I was writing yesterday, I realized that my code was sloppy, particular to my needs, and nearly unusable. I refactored the script to be more intuitive. When called, the script switches to the desktop specified by the first argument (it's zero-indexed), drops in a new background image list, and updates the background. The background changes a few hundred ms after switching, but it's good enough for me.
Here are directions for using it:
- Download the script, and save it as switch.sh. Make sure it's executable.
- Install wmctrl from your distributions' repositories.
- Create an image list for each of your desktops. You can use XFCE to generate them (in Desktop settings, create an image list, then save it), or you can create it by hand (it's a text file whose first line is "# xfce backdrop list", followed by full paths to images, one per line)
- Save one image list for each of your desktops, and remember their locations.
- Edit switch.sh, and insert your image lists where prompted. The contents of the CURRENT variable should be the background list XFCE is set to use.
- In the XFCE settings manager, go to Window Manager, click the keyboard tab, and disable the shortcuts for switching workspaces.
- Go back to the settings manager, and go into Keyboard settings, and click the application shortcuts tab.
- Create a shortcut for each of your workspaces. The first shortcut should run switch.sh 0 on the keyboard shortcut Ctrl+F1.
- Add a shortcut for each workspace.
- Make sure that XFCE is drawing images from the link set by CURRENT.
Here's the script!