View previous topic :: View next topic |
Author |
Message |
kerick n00b
Joined: 20 Jan 2003 Posts: 59
|
Posted: Thu Mar 02, 2006 12:59 am Post subject: HOWTO: Wallpaper on each workspace in Openbox/PekWM |
|
|
So I was on the look for a different WM/Panel/desktop whatever yesterday. I found what I wanted except for one thing. Fluxbox has individual wallpaper per workspace ( through fluxter or fluxspace ) and Openbox doesn't. I wanted to use Openbox, so I didn't have to give up my precious pypanel. Of Course, I was not happy when I found out I didn't have a choice between the two for this...So I wrote a script to hang out and do the same thing fluxter does when it switches wallpapers per workspace. Also, I'll throw in a little bonus, which you may or may not care about. Mostly because I have a large collection of wallpapers in separate folders and demand that I can access them all from one script.
*EDIT Now I'm using PekWM and this works great
Also now a way to do this with Dual Head Displays+Xinerama
#include <Std_Disclaimer.h>
First create a list of wallpapers that have their full path
find /home/storage/Picturesandstuff/Wallpaper/ -type f > wallpaperlist
Next use a script similar to this one ( I modified someone else's from this forum )
Depending on the amount of your workspaces you may want to make additional scripts or bunch them all up into one
This will make a link from one of your wallpapers to a link in the directory that you modify it to
Code: |
#!/bin/bash
IMGLIST=/home/jc/scripts/wallpaperlist
IMGLINE=0
WALLPAPERLINK=/home/jc/scripts/background1.jpg
IMGCOUNT=$(cat ${IMGLIST} | wc -l | awk '{print $1}')
while [ ${IMGLINE} -eq 0 ]
do
IMGLINE=${RANDOM}
let "IMGLINE %= ${IMGCOUNT}"
done
NEWWALLPAPER=$(head -${IMGLINE} ${IMGLIST} | tail -1)
ln -sf ${NEWWALLPAPER} ${WALLPAPERLINK}
|
*EDIT If you're using Dual Head Xinerama ( Maybe this will work with Nvidia's Dual Head as well )
This will also require ImageMagick to be installed
Code: |
#!/bin/bash
#Change MAXWIDTH to the width of your dual displays ex. 1280 * 2 = 2560
MAXWIDTH=2560
IMGLIST=/home/jc/scripts/wallpaperlist
IMGLINE=0
IMGLINE2=0
WALLPAPERLINK=/home/jc/scripts/background1.jpg
IMGCOUNT=$(cat ${IMGLIST} | wc -l | awk '{print $1}')
while [ ${IMGLINE} -eq 0 ]
do
IMGLINE=${RANDOM}
let "IMGLINE %= ${IMGCOUNT}"
done
while [ ${IMGLINE2} -eq 0 ]
do
IMGLINE2=${RANDOM}
let "IMGLINE2 %= ${IMGCOUNT}"
done
WALL1=$(head -${IMGLINE} ${IMGLIST} | tail -1)
WALL2=$(head -${IMGLINE2} ${IMGLIST} | tail -1)
`convert ${WALL1} -resize 2560 ${WALL2} -resize 2560 +append -geometry 2560x1024 ${WALLPAPERLINK}`
|
Next I threw my scripts into cron as follows ( Because when you have thousands of wallpapers, you want to see them all ) :
Code: |
10 * * * * /home/jc/scripts/randompaper
10 * * * * /home/jc/scripts/randompaper2
10 * * * * /home/jc/scripts/randompaper3
10 * * * * /home/jc/scripts/randompaper4
|
Now for the wallpaper Changer, Which you may or may not want to start when openbox runs
Code: |
#!/bin/bash
CURRENTDESKTOP=`xprop -root | grep '_NET_CURRENT_DESKTOP(CARDINAL*' | awk -F= '{print $2}'`
OLDDESKTOP=5
while :
do
sleep 2
CURRENTDESKTOP=`xprop -root | grep '_NET_CURRENT_DESKTOP(CARDINAL*' | awk -F= '{print $2}'`
if [ $CURRENTDESKTOP -ne $OLDDESKTOP ]; then
case $CURRENTDESKTOP
in
*0) fbsetbg /home/jc/scripts/background1.jpg;;
*1) fbsetbg /home/jc/scripts/background2.jpg;;
*2) fbsetbg /home/jc/scripts/background3.jpg;;
*3) fbsetbg /home/jc/scripts/background4.jpg;;
esac
OLDDESKTOP=$CURRENTDESKTOP
fi
done
|
This is only for the default 4 workspace enviroment, but if you add additional lines it should work fine. Unfortunately on my AMD64 box wmctrl isn't working so I had to take the half-assed approach as you can see in $CURRENTDESKTOP.
I'm sure someone can write this a little better (after all not much time was spent on it anyways), but it works. _________________ -----------------
Thats funny, my post count tells me I'm a n00b... |
|
Back to top |
|
|
kerick n00b
Joined: 20 Jan 2003 Posts: 59
|
Posted: Mon Jul 17, 2006 11:31 pm Post subject: |
|
|
Updated. |
|
Back to top |
|
|
darkmason Tux's lil' helper
Joined: 31 Aug 2003 Posts: 116 Location: London, UK
|
Posted: Tue Oct 03, 2006 10:27 pm Post subject: |
|
|
I've just started using PekWM, and I made to a basic script to do something similar last night. But I never had the idea of having different backgrounds on different workspaces, I like it. Thanks for the ideas, I'm off to go try them out. _________________ emerge sex cowsay
sex | cowsay -f sodomized
sex | festival --tts |
|
Back to top |
|
|
darkmason Tux's lil' helper
Joined: 31 Aug 2003 Posts: 116 Location: London, UK
|
Posted: Tue Oct 03, 2006 11:52 pm Post subject: |
|
|
If you're interested, heres what I ended up with for my 4 workspace PekWM:
Code: |
#!/bin/bash
IMGCOUNT=0
WALLPAPERDIR=/home/dark/.pekwm/wallpaper
for i in `find $WALLPAPERDIR -type f -printf '%h/%f\n'`
do
IMGLIST=$IMGLIST$i:
IMGCOUNT=$(($IMGCOUNT + 1))
done
for i in 0 1 2 3
do
IMGLINE=0
while [ ${IMGLINE} -eq 0 ]
do
IMGLINE=${RANDOM}
let "IMGLINE %= ${IMGCOUNT}"
done
NEWWALLPAPER=`echo $IMGLIST | cut -d : -f $IMGLINE`
ln -sf ${NEWWALLPAPER} $WALLPAPERDIR/symlinks/$i
done |
I keep all my wallpapers in /home/dark/.pekwm/wallpapers and all the symlinks are created in the subdirectory 'symlinks' in the form wallpapers/symlinks/1, wallpapers/symlinks/2 etc.
Saves having to make a wallpaperlist. _________________ emerge sex cowsay
sex | cowsay -f sodomized
sex | festival --tts |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|