Just thought I'd share this with you.

I played around with random wallpapers with desktops other than WM.
Since in my new job I'm back on a Linux box again (and thus back to
WM) I wanted something similar.

I found that tools like 'variety' do not seem to work. But there's wmsetbg.
And though you can't set different backgrounds per workspace in
WPrefs, wmsetbg can do it quite nicely.

So I did the following:
- created a directory for my wallpaper images
- symlinked all backgrounds I wanted to choose from into it
- wrote a little shell script :)

The script that does the work looks like this:

md@Paulina:[ ~/ ] % cat bin/random-backgrounds.sh
#!/bin/sh

cd /usr/local/share/backgrounds/Variety/
while true; do
  w=0
  date
  for i in `ls *.* | catrand`; do
    case $i in
      cat*)
        # cat photos as backgrounds won't be stretched but rather
cropped to fit to my screen
        CMD="wmsetbg -f -w $w $i"
        ;;
      *)
        # all other photos will be stretched to fit
        CMD="wmsetbg -w $w $i"
        ;;
    esac
    echo "$CMD"
    $CMD
    w=`expr $w + 1`
    # I've got 7 desktops I use regularly
    if [ $w -gt 6 ]; then
      break
    fi
  done
  sleep 10m
done

This script changes wallpapers for desktops #0 .. #6 every 10 minutes.
You will have to change between desktops to get to see this.

For randomization I use a little CLI utility that I wrote ages ago:
http://www.the-little-red-haired-girl.org/pub/linux/catrand-1.2-1.src.rpm
- as it is the script will not work without it, but you may want to
replace this by something else to create a shuffled list of the file
names.

Since it replaces newlines by spaces I can't really do any of those
neat things allowing me to iterate over file names containing white
spaces in my script, therefore all symlinks have normalised file
names, i.e. without white spaces.

The calls to wmsetbg are echoed. I use this for identifying wallpapers
to blacklist (i.e. remove the symlinks from my wallpaper directory) if
they don't come out good.

I run this script automatically in the background. Depending on Linux
distros there's different places in $HOME where you can put stuff like
this. I use a fairly low-level approach:

Support for a script $HOME/.xapps to execute at the start of an xsession:

md@Paulina:[ ~/ ] % cat /etc/X11/xinit/xinitrc.d/70-xapps.sh
#!/bin/sh

if [ -x "$HOME/.xapps" ]; then
  "$HOME/.xapps"
fi

My actual $HOME/.xapps script:

md@Paulina:[ ~/ ] % cat /etc/X11/xinit/xinitrc.d/70-xapps.sh
#!/bin/sh

if [ -x "$HOME/.xapps" ]; then
  "$HOME/.xapps"
fi


Note that I don't really care if any other program runs nohup'ed in
/tmp on my box. Since I use it exclusively I am fairly sure there
isn't :)

That's it. Of course, it's nothing more than a quick hack, but it does
the job quite well. Integration of this kind of functionality into WM
would be nice someday, but in the meantime this will do :)

Cheers,

m'bert

-- 
---------- mdie...@gmail.com --/-- mar...@the-little-red-haired-girl.org ----
------------- / http://herbert.the-little-red-haired-girl.org / -------------


-- 
To unsubscribe, send mail to wmaker-user-unsubscr...@lists.windowmaker.org.

Reply via email to