JWM: Set different background image for each virtual desktop

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

JWM: Set different background image for each virtual desktop

#1 Post by MochiMoppel »

JWM has the ability to set individual backgrounds for each of its (max 10 ) virtual desktops.
To get the terms straight: Every Puppy I know by default boots into a "desktop" with several application- and drive icons and a background image. Technically this is not the desktop. It is a special ROX window, maximised, lowest layer and sticky. ROX calls it pinboard. This window is placed on JWM's desktop, which can have its own background, but users will never see JWM's desktop unless they remove the pinboard.

Let's start with the normal case:

Example 1: Set different ROX pinboard background for each virtual desktop
Example sets 4 virtual desktops in 1 row. Uses script /usr/local/apps/Wallpaper/set_bg and sets 4 images found in directory /usr/share/backgrounds/ of Slacko 5.6.

Step1: Edit /root/.jwm/jwmrc-personal and change

Code: Select all

<Desktops width="2" height="2"/>
to

Code: Select all

<Desktops width="4" height="1">
	<Desktop><Background type="command">/usr/local/apps/Wallpaper/set_bg /usr/share/backgrounds/default.jpg</Background></Desktop>
	<Desktop><Background type="command">/usr/local/apps/Wallpaper/set_bg /usr/share/backgrounds/puppylinux.jpg</Background></Desktop>
	<Desktop><Background type="command">/usr/local/apps/Wallpaper/set_bg /usr/share/backgrounds/bike-outback.jpg</Background></Desktop>
	<Desktop><Background type="command">/usr/local/apps/Wallpaper/set_bg /usr/share/backgrounds/world-fiveworld.png</Background></Desktop>
</Desktops>
Step 2: Restart JWM

Example 2: Set different JWM background for each virtual desktop
"Hardcore" users who remove the pinboard know how to do it and how to reset it, so I will not explain here. They have more options to set the background and can also use solid or gradient colors:

Code: Select all

<Desktops width="4" height="1">
	<Desktop><Background type="solid">#870025</Background></Desktop>
	<Desktop><Background type="gradient">#000000:#0000DD</Background></Desktop>
	<Desktop><Background type="tile">/usr/share/icons/sys-info.png</Background></Desktop>
	<Desktop><Background type="image">/usr/share/backgrounds/default.jpg</Background></Desktop>
</Desktops>
<Background type="command"> could also be used. It can run any script(s) or command(s) when a user switches to the desktop.
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Re: JWM: Set different background image for each virtual desktop

#2 Post by greengeek »

MochiMoppel wrote:<Background type="command"> could also be used. It can run any script(s) or command(s) when a user switches to the desktop
That sounds like a handy tool. Thanks for the tutorial.
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Yeah, thanks, MochiMoppel.

I didn't know jwm could do that. (Blame its complicated docs...)

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
gcmartin

#4 Post by gcmartin »

I have a need to set a different background on the last virtual desktop. So from your 4 desktop example1, how would I leave all the same and ONLY change the background in the very last desktop?

Thanks in advance for any guidance
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#5 Post by MochiMoppel »

gcmartin wrote:how would I leave all the same and ONLY change the background in the very last desktop?
This should work:

Code: Select all

<Desktops width="4" height="1">
  <Background type="command">/usr/local/apps/Wallpaper/set_bg /usr/share/backgrounds/bike-outback.jpg</Background>
    <Desktop></Desktop> 
    <Desktop></Desktop> 
    <Desktop></Desktop> 
    <Desktop><Background type="command">/usr/local/apps/Wallpaper/set_bg /usr/share/backgrounds/world-fiveworld.png</Background></Desktop> 
</Desktops>
The 2nd line sets the default background for all desktops. You can set a different background for any individual desktop, but you have to tag every desktop up to the changed one so that JWM can count and know which one to change. If you had 10 instead of only 4 desktops, above example would still change only the 4th and apply the default image to desktops 5~10.
Bushbuck
Posts: 179
Joined: Sat 26 Jan 2013, 01:33

Re: JWM: Set different background image for each virtual desktop

#6 Post by Bushbuck »

MochiMoppel wrote:JWM has the ability to set individual backgrounds for each of its (max 10 ) virtual desktops...
Thanks for the instructions, MochiMoppel! :D
I've always wanted to do this, but didn't know how, or if it was possible.
gcmartin

#7 Post by gcmartin »

Thanks @MochiMoppel, that makes perfect.

Curious
Wonder if this can be applied to FD6xx and PUPs which use Openbox instead of JWM?
User avatar
mister_electronico
Posts: 969
Joined: Sun 20 Jan 2008, 20:20
Location: Asturias_ España
Contact:

thanks MochiMoppel

#8 Post by mister_electronico »

thanks MochiMoppel works perfect in slacko 5.7...

very good post.
Post Reply