On Thu, 19 Mar 2015, Martin Dietze wrote:
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
What does catrand do? Can it not be done with standard tools, e.g. awk?
And that is almost always the wrong way to loop through filenames.
Done properly, you don't need to worry about spaces in filenames:
printf * | catrand | ## better would be to have catrand take arguments: catrand
*
while read file
do
: whatever
done
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`
Why are you using an external (i.e. slow) command. Use shell arithmetic:
w=$(( w + 1 ))
# I've got 7 desktops I use regularly
if [ $w -gt 6 ]; then
break
fi
done
sleep 10m
done
--
Chris F.A. Johnson, <http://cfajohnson.com>
--
To unsubscribe, send mail to wmaker-user-unsubscr...@lists.windowmaker.org.