Different Backgrounds On Different Desktops Not Possible?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
palo
Level 4
Level 4
Posts: 476
Joined: Mon Jun 25, 2012 7:28 am
Location: Walking on sunshine

Re: Different Backgrounds On Different Desktops Not Possible

Post by palo »

homerscousin wrote:I found an Ubuntu or KDE forum thread and someone said KDE is the only desktop to make this easy. I believe it. Actually they said KDE is the only desktop to do it.
Just goes to show you that on the web people are making seemingly "factual" statements and they don't know what they are talking about. BTW I love(d) KDE too - just got fed up with all the changes. See the third post on this thread - it is actually easier to do than with KDE.

Pat
caribriz

Re: Different Backgrounds On Different Desktops Not Possible

Post by caribriz »

jimwg wrote:Flash! A fascinating mention by ToZ!!

From ToZ:

Try this simple memory-resident script. You can load it manually from the terminal or add it to your startup applications. It cycles continuously and every second checks to see if the workspace has changed (using wmctrl) and if so, changes the wallpaper. Not ideal, but it will work.

You need to edit the script to change NUMBER_WORKSPACES to be the number of workspaces that you have and also edit the values in the WORKSPACE_WALL array to point to the wallpapers that you want to use for every workspace.

#!/bin/bash
# The Poor Man's Wallpaper/Workspace solution
# Requires: wmctrl
# Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
# Remember: Xfce starts counting workspaces at 0.

lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/usr/share/backgrounds/space-01.jpg
WORKSPACE_WALL[1]=/usr/share/backgrounds/space-02.jpg
WORKSPACE_WALL[2]=/usr/share/backgrounds/space-03.jpg
WORKSPACE_WALL[3]=/usr/share/backgrounds/space-04.jpg

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${WORKSPACE_WALL[$NEW_WORKSPACE]}
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi


I'm no techie but does this solution do the job?

Jim in NYC
Jim - I'm no techie either :wink: - but I had a go at the solution by ToZ in both a flash drive full install of LM13 xfce and a live LM14 xfce.
It seems to work - with just a minor lag when switching desktops.

If interested, this is how I did it for LM14 xfce - your mileage may vary ....

Note: for the experiment I just used three of the images in LM14 /usr/share/backgrounds for Workspaces 1, 2 and 3
.... I left Workspace 0 as the original desktop wallpaper, gelsan_green.png - the images are different for LM13 xfce:

Added Workspace Switcher to panel, went to Settings > Workspaces and made 4 sure workspaces were enabled (should be by default ?)

Open terminal, enter commands:

sudo apt-get install wmctrl

mkdir .scripts

cd .scripts

gedit workspace-wall-change

gedit opens .... copied/pasted the text below -

Code: Select all

 #!/bin/bash
 # The Poor Man's Wallpaper/Workspace solution by ToZ
 # Requires: wmctrl
 # Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
 # Remember: Xfce starts counting workspaces at 0.

 lockfile=/tmp/.wspm.lockfile
 if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
 trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
 echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/usr/share/backgrounds/gelsan_green.png
WORKSPACE_WALL[1]=/usr/share/backgrounds/sparks.jpg
WORKSPACE_WALL[2]=/usr/share/backgrounds/stars.jpg
WORKSPACE_WALL[3]=/usr/share/backgrounds/water.jpg

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${WORKSPACE_WALL[$NEW_WORKSPACE]}
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi


saved file (you're already in .scripts folder, so just clicked save) > closed gedit

in same terminal, make the file executable:
chmod +x workspace-wall-change
exit terminal

Settings > Session and Startup > Application Autostart > click Add
type in name: workspace-wall-change
in command type in: /home/your-own-username/.scripts/workspace-wall-change
click ok

click Session tab > click Save session

logout/in

When trying it in LM13 xfce I somehow managed to "lose" my window settings as I have done at times in the past ...
I just opened a terminal and entered xfwm4

So - it worked for me - see how you go.
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

caribriz wrote: When trying it in LM13 xfce I somehow managed to "lose" my window settings as I have done at times in the past ...
I just opened a terminal and entered xfwm4

So - it worked for me - see how you go.
Thanks! I'll check this out soon as I can! If there was a way to give this script a Clonzeilla-like graphical command line interface so newbies can more easily select images to workplace windows (and make XFCE even more appealing) this can be a keeper! I hope XFCE developers catch wind of this as a newbie-easy add-on or feature that can take the "only we can do it" bluster out of KDE's sails! Good job!!!

Jim in NYC
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

caribriz wrote:
jimwg wrote:Flash! A fascinating mention by ToZ!!

From ToZ:

Try this simple memory-resident script. You can load it manually from the terminal or add it to your startup applications. It cycles continuously and every second checks to see if the workspace has changed (using wmctrl) and if so, changes the wallpaper. Not ideal, but it will work.

You need to edit the script to change NUMBER_WORKSPACES to be the number of workspaces that you have and also edit the values in the WORKSPACE_WALL array to point to the wallpapers that you want to use for every workspace.

#!/bin/bash
# The Poor Man's Wallpaper/Workspace solution
# Requires: wmctrl
# Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
# Remember: Xfce starts counting workspaces at 0.

lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/usr/share/backgrounds/space-01.jpg
WORKSPACE_WALL[1]=/usr/share/backgrounds/space-02.jpg
WORKSPACE_WALL[2]=/usr/share/backgrounds/space-03.jpg
WORKSPACE_WALL[3]=/usr/share/backgrounds/space-04.jpg

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${WORKSPACE_WALL[$NEW_WORKSPACE]}
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi


I'm no techie but does this solution do the job?

Jim in NYC
Jim - I'm no techie either :wink: - but I had a go at the solution by ToZ in both a flash drive full install of LM13 xfce and a live LM14 xfce.
It seems to work - with just a minor lag when switching desktops.

If interested, this is how I did it for LM14 xfce - your mileage may vary ....

Note: for the experiment I just used three of the images in LM14 /usr/share/backgrounds for Workspaces 1, 2 and 3
.... I left Workspace 0 as the original desktop wallpaper, gelsan_green.png - the images are different for LM13 xfce:

Added Workspace Switcher to panel, went to Settings > Workspaces and made 4 sure workspaces were enabled (should be by default ?)

Open terminal, enter commands:

sudo apt-get install wmctrl

mkdir .scripts

cd .scripts

gedit workspace-wall-change

gedit opens .... copied/pasted the text below -

Code: Select all

 #!/bin/bash
 # The Poor Man's Wallpaper/Workspace solution by ToZ
 # Requires: wmctrl
 # Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
 # Remember: Xfce starts counting workspaces at 0.

 lockfile=/tmp/.wspm.lockfile
 if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
 trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
 echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/usr/share/backgrounds/gelsan_green.png
WORKSPACE_WALL[1]=/usr/share/backgrounds/sparks.jpg
WORKSPACE_WALL[2]=/usr/share/backgrounds/stars.jpg
WORKSPACE_WALL[3]=/usr/share/backgrounds/water.jpg

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${WORKSPACE_WALL[$NEW_WORKSPACE]}
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi


saved file (you're already in .scripts folder, so just clicked save) > closed gedit

in same terminal, make the file executable:
chmod +x workspace-wall-change
exit terminal

Settings > Session and Startup > Application Autostart > click Add
type in name: workspace-wall-change
in command type in: /home/your-own-username/.scripts/workspace-wall-change
click ok

click Session tab > click Save session

logout/in

When trying it in LM13 xfce I somehow managed to "lose" my window settings as I have done at times in the past ...
I just opened a terminal and entered xfwm4

So - it worked for me - see how you go.

Using Nadia XFCE but doesn't seem to work. :( Maybe my workspace image addresses from Pictures folder are too long or the script only works with images inside usr folder? Or does desktop wallpaper menu have to be set to single image or none? The Workspace Switcher menu doesn't seem to list 0 as a start number, just 1 to 4. Could that be a hangup? Just wildly guessing and will check out more.

Jim in NYC
caribriz

Re: Different Backgrounds On Different Desktops Not Possible

Post by caribriz »

jimwg wrote:Using Nadia XFCE but doesn't seem to work. :( Maybe my workspace image addresses from Pictures folder are too long or the script only works with images inside usr folder? Or does desktop wallpaper menu have to be set to single image or none? The Workspace Switcher menu doesn't seem to list 0 as a start number, just 1 to 4. Could that be a hangup? Just wildly guessing and will check out more.

Jim in NYC
Hi Jim -
Just tried it again, a few different times in LM14 xfce (live).

The first time it didn't work :shock: - so rebooted, and tried again.

2nd time - did work - this was as I posted above - with the 4 images in /usr/share/backgrounds.
Rebooted and tried again.

3rd time - this time I tried it with the same images as before, but located in /home/mint/Pictures - I copied the 4 images from /usr/share/backgrounds to /home/mint/Pictures and edited workspace-wall-change script image lines to read:

Code: Select all

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/home/mint/Pictures/gelsan_green.png
WORKSPACE_WALL[1]=/home/mint/Pictures/sparks.jpg
WORKSPACE_WALL[2]=/home/mint/Pictures/stars.jpg
WORKSPACE_WALL[3]=/home/mint/Pictures/water.jpg
Saved the file, and continued the instructions as before.

It worked again.

In Desktop settings - on each occasion, it was set as "single image".
In Workspace Switcher menu, it is listed as 1 to 4 - contrary to what is in the script - "# Remember: Xfce starts counting workspaces at 0." :?

This was the result, regardless of whether the images were located in /usr/share/backgrounds OR /home/mint/Pictures:
workspaces 1 and 2.png
workspaces 3 and 4.png
As I said, this was done on a live usb of LM14 xfce, but I did do it as well in full install of LM13 xfce.

So, I'm not sure why it didn't work for me first time - it's working now.
Maybe you could start over and try to recreate what I did exactly - using the same images in /usr/share/backgrounds - just to see if that works?
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

Sorry if seems confusing but I'm trying to get your great ideas in sync! Really want to see this work! I'll test out both your ideas ASAP!

jimwg
Member
Registered: 2011-12-11
Posts: 36
Email

Re: Different Desktop Backgrounds Not XFCE Possible?
ToZ wrote:

Try this simple memory-resident script. You can load it manually from the terminal or add it to your startup applications. It cycles continously and every second checks to see if the workspace has changed (using wmctrl) and if so, changes the wallpaper. Not ideal, but it will work.

You need to edit the script to change NUMBER_WORKSPACES to be the number of workspaces that you have and also edit the values in the WORKSPACE_WALL array to point to the wallpapers that you want to use for every workspace.

#!/bin/bash
# The Poor Man's Wallpaper/Workspace solution
# Requires: wmctrl
# Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
# Remember: Xfce starts counting workspaces at 0.

lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/usr/share/backgrounds/space-01.jpg
WORKSPACE_WALL[1]=/usr/share/backgrounds/space-02.jpg
WORKSPACE_WALL[2]=/usr/share/backgrounds/space-03.jpg
WORKSPACE_WALL[3]=/usr/share/backgrounds/space-04.jpg

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${WORKSPACE_WALL[$NEW_WORKSPACE]}
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi


Using Nadia XFCE but doesn't seem to work. sad No images outside regular wallpaper shows. The Workspace Switcher menu doesn't seem to list 0 as a start number, just 1 to 4. Could that be a hangup? Just wildly guessing and will check out more.

Jim in NYC

Last edited by jimwg (Today 08:18:01)

Online

Report
Delete
Edit
Quote

#8 Today 09:00:01

ToZ
Member
Registered: 2011-06-02
Posts: 256
Email

Re: Different Desktop Backgrounds Not XFCE Possible?

Although the Workspace switcher lists the workspaces as 1 to 4, internally they are managed as 0 to 3.

1. Do you have a single monitor setup?

2. Can you post back your edited version of the script?

3. Can you run the following commands and post back the results?

xfconf-query -c displays -p /Default -l | cut -d'/' -f3 | uniq | wc -l

wmctrl -d

wmctrl -d | grep \* | cut -d' ' -f1

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path

ps -ef | grep xfdesktop

4. Can you run this command and see if it changes the wallpaper:

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s /path/to/image/file

...replace /path/to/image/file with the path to an actual wallpaper file.

Offline

Report
Quote

#9 Today 09:20:38

jimwg
Member
Registered: 2011-12-11
Posts: 36
Email

Re: Different Desktop Backgrounds Not XFCE Possible?
ToZ wrote:

Although the Workspace switcher lists the workspaces as 1 to 4, internally they are managed as 0 to 3.

1. Do you have a single monitor setup?

2. Can you post back your edited version of the script?

3. Can you run the following commands and post back the results?

xfconf-query -c displays -p /Default -l | cut -d'/' -f3 | uniq | wc -l

wmctrl -d

wmctrl -d | grep \* | cut -d' ' -f1

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path

ps -ef | grep xfdesktop

4. Can you run this command and see if it changes the wallpaper:

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s /path/to/image/file

...replace /path/to/image/file with the path to an actual wallpaper file.


jimwg@bluemint1 ~ $ xfconf-query -c displays -p /Default -l | cut -d'/' -f3 | uniq | wc -l
1
jimwg@bluemint1 ~ $ wmctrl -d
0 * DG: 1024x768 VP: 0,0 WA: 0,0 1024x768 Workspace 1
1 - DG: 1024x768 VP: N/A WA: 0,0 1024x768 Workspace 2
2 - DG: 1024x768 VP: N/A WA: 0,0 1024x768 Workspace 3
3 - DG: 1024x768 VP: N/A WA: 0,0 1024x768 Workspace 4
jimwg@bluemint1 ~ $ wmctrl -d | grep \* | cut -d' ' -f1
0
jimwg@bluemint1 ~ $ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path
/path/to/image/file
jimwg@bluemint1 ~ $ ps -ef | grep xfdesktop
jimwg 7220 7191 0 08:06 ? 00:00:01 xfdesktop --display :0.0 --sm-client-id 24c961fc5-264d-4941-b143-8e985c032848
jimwg 7937 7879 0 09:09 pts/0 00:00:00 grep --colour=auto xfdesktop
jimwg@bluemint1 ~ $

jimwg@bluemint1 ~ $ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s /usr/share/backgrounds/stars.jpg

Works displaying stars.jpg

Also -- using a user's slightly modified version by caribriz from LinuxMint:

Jim - I'm no techie either :wink: - but I had a go at the solution by ToZ in both a flash drive full install of LM13 xfce and a live LM14 xfce.
It seems to work - with just a minor lag when switching desktops.

If interested, this is how I did it for LM14 xfce - your mileage may vary ....

Note: for the experiment I just used three of the images in LM14 /usr/share/backgrounds for Workspaces 1, 2 and 3
.... I left Workspace 0 as the original desktop wallpaper, gelsan_green.png - the images are different for LM13 xfce:

Added Workspace Switcher to panel, went to Settings > Workspaces and made 4 sure workspaces were enabled (should be by default ?)

Open terminal, enter commands:

sudo apt-get install wmctrl

mkdir .scripts

cd .scripts

gedit workspace-wall-change

gedit opens .... copied/pasted the text below -

Code: Select all
#!/bin/bash
# The Poor Man's Wallpaper/Workspace solution by ToZ
# Requires: wmctrl
# Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
# Remember: Xfce starts counting workspaces at 0.

lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/usr/share/backgrounds/gelsan_green.png
WORKSPACE_WALL[1]=/usr/share/backgrounds/sparks.jpg
WORKSPACE_WALL[2]=/usr/share/backgrounds/stars.jpg
WORKSPACE_WALL[3]=/usr/share/backgrounds/water.jpg

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ${WORKSPACE_WALL[$NEW_WORKSPACE]}
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi

saved file (you're already in .scripts folder, so just clicked save) > closed gedit

in same terminal, make the file executable:
chmod +x workspace-wall-change
exit terminal

Settings > Session and Startup > Application Autostart > click Add
type in name: workspace-wall-change
in command type in: /home/your-own-username/.scripts/workspace-wall-change
click ok

click Session tab > click Save session

logout/in

When trying it in LM13 xfce I somehow managed to "lose" my window settings as I have done at times in the past ...
I just opened a terminal and entered xfwm4

So - it worked for me - see how you go.

=========================================================

Top

Re: Different Backgrounds On Different Desktops Not Possible

Unread postby caribriz on Tue Jun 25, 2013 8:52 am

jimwg wrote:Using Nadia XFCE but doesn't seem to work. sad Maybe my workspace image addresses from Pictures folder are too long or the script only works with images inside usr folder? Or does desktop wallpaper menu have to be set to single image or none? The Workspace Switcher menu doesn't seem to list 0 as a start number, just 1 to 4. Could that be a hangup? Just wildly guessing and will check out more.

Jim in NYC


Hi Jim -
Just tried it again, a few different times in LM14 xfce (live).

The first time it didn't work :shock: - so rebooted, and tried again.

2nd time - did work - this was as I posted above - with the 4 images in /usr/share/backgrounds.
Rebooted and tried again.

3rd time - this time I tried it with the same images as before, but located in /home/mint/Pictures - I copied the 4 images from /usr/share/backgrounds to /home/mint/Pictures and edited workspace-wall-change script image lines to read:

Code: Select all
###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]=/home/mint/Pictures/gelsan_green.png
WORKSPACE_WALL[1]=/home/mint/Pictures/sparks.jpg
WORKSPACE_WALL[2]=/home/mint/Pictures/stars.jpg
WORKSPACE_WALL[3]=/home/mint/Pictures/water.jpg


Saved the file, and continued the instructions as before.

It worked again.

In Desktop settings - on each occasion, it was set as "single image".
In Workspace Switcher menu, it is listed as 1 to 4 - contrary to what is in the script - "# Remember: Xfce starts counting workspaces at 0." :?

This was the result, regardless of whether the images were located in /usr/share/backgrounds OR /home/mint/Pictures:

workspaces 1 and 2.png
LM14 xfce workspaces 1 and 2

workspaces 3 and 4.png
LM14 xfce workspaces 3 and 4


As I said, this was done on a live usb of LM14 xfce, but I did do it as well in full install of LM13 xfce.

So, I'm not sure why it didn't work for me first time - it's working now.
Maybe you could start over and try to recreate what I did exactly - using the same images in /usr/share/backgrounds - just to see if that works?
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

wmctrl -d

...lists the workspaces. Notice that the first one is 0. Perhaps the more accurate statement is to say that wmctrl counts workspaces starting at 0 (not Xfce). Sorry about that confusion. I've edited my original script.

jimwg@bluemint1 ~ $ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path
/path/to/image/file

...this should not say /path/to/file, but rather have the actual path to a file. For example:

$ xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path
/home/toz/Pictures/DualScreen/Eye.jpg

Can you post back the contents of your script file so that I can review it?

Just like the other poster you've quoted, this works fine on my install (single monitor/4 workspaces) like your setup. You can fine-tune the delay by changing the sleep command. Right not its set a 1 (1 second). You can set it at 0.5 (half a second) if you want it more responsive. Just keep in mind that you will have a program running on your computer that is cycling every half a second.

Last edited by ToZ (Today 09:41:38)

Offline

Report
Quote

#11 Today 09:45:51

ToZ
Member
Registered: 2011-06-02
Posts: 260
Email

Re: Different Desktop Backgrounds Not XFCE Possible?

One other thing to keep in mind. If you are making changes to the script while its running, you have to kill the existing script before the changes will show. To do so, if you've named the script wspm for example, then:

killall wspm

...then restart the script to test.

Offline

Report
Quote

#12 Today 10:16:57

ToZ
Member
Registered: 2011-06-02
Posts: 260
Email

Re: Different Desktop Backgrounds Not XFCE Possible?

Just found a bug - wasn't accounting for wallpapers with spaces in the name. Here is an updated version of the script that fixes that issue:

#!/bin/bash
# The Poor Man's Desktop/Workspace solution
# Requires: wmctrl
# Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
# Remember: wmctrl starts counting workspaces at 0.

lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]="/home/toz/Pictures/Abstract Smoke.jpg"
WORKSPACE_WALL[1]="/home/toz/Pictures/Bello Nebula.jpg"
WORKSPACE_WALL[2]="/home/toz/Pictures/Cold Morning.jpg"
WORKSPACE_WALL[3]="/home/toz/Pictures/Evenings Rest.jpg"

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${WORKSPACE_WALL[$NEW_WORKSPACE]}"
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi

Offline

Report
Quote

#13 Today 12:03:38

jimwg
Member
Registered: 2011-12-11
Posts: 38
Email

Re: Different Desktop Backgrounds Not XFCE Possible?
ToZ wrote:

Can you post back the contents of your script file so that I can review it?

Hope this helps though can't see how as the only things I replaced were the image paths!

#!/bin/bash
# The Poor Man's Desktop/Workspace solution
# Requires: wmctrl
# Make sure you edit the NUMBER_WORKSPACES and WORKSPACE_WALL array to suit.
# Remember: wmctrl starts counting workspaces at 0.

lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "Locking succeeded" >&2

###### EDIT THESE VALUES
NUMBER_WORKSPACES=4
WORKSPACE_WALL[0]="/usr/share/backgrounds/Aquarius.svg"
WORKSPACE_WALL[1]="/usr/share/backgrounds/stars.jpg"
WORKSPACE_WALL[2]="/home/amberella/Pictures/VictoriAlisha-Amberella/alisha photos1_files/Alisha Dodd glamorous.jpg"
WORKSPACE_WALL[3]="/home/amberella/Pictures/VictoriAlisha-Amberella/alisha photos1_files/alishasummer1-13viorbs.jpg"

###### DO NOT EDIT BELOW
CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)

while true
do
sleep 1
NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $NEW_WORKSPACE
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${WORKSPACE_WALL[$NEW_WORKSPACE]}"
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "Lock failed - exit" >&2
exit 1
fi

Online

Report
Delete
Edit
Quote

#14 Today 13:14:43

ToZ
Member
Registered: 2011-06-02
Posts: 260
Email

Re: Different Desktop Backgrounds Not XFCE Possible?

Assuming that the wrapped lines are because of the post here and are not wrapped in the actual script, the script looks good. Is it still not working (as it should work)?

What did you name the file and where did you save it?

Is it currently running. You can use "ps -ef | grep <NAME>" where <NAME> is the name of the script to check. For example:

toz@xubi:~$ ps -ef | grep wspm
toz 753 696 0 13:07 pts/0 00:00:00 /bin/bash /home/toz/bin/wspm
toz 851 780 0 13:07 pts/2 00:00:00 grep wspm

Offline

Report
Quote

#15 Today 13:40:08

jimwg
Member
Registered: 2011-12-11
Posts: 38
Email

Re: Different Desktop Backgrounds Not XFCE Possible?
ToZ wrote:

Assuming that the wrapped lines are because of the post here and are not wrapped in the actual script, the script looks good. Is it still not working (as it should work)?

What did you name the file and where did you save it?

Is it currently running. You can use "ps -ef | grep <NAME>" where <NAME> is the name of the script to check. For example:

toz@xubi:~$ ps -ef | grep wspm
toz 753 696 0 13:07 pts/0 00:00:00 /bin/bash /home/toz/bin/wspm
toz 851 780 0 13:07 pts/2 00:00:00 grep wspm

jimwg@bluemint1 ~ $ ps -ef | grep workspace-wall-change
jimwg 1867 1 0 13:11 ? 00:00:00 /bin/sh /home/jimwg/.scripts/workspace-wall-change
jimwg 10022 7165 0 13:36 pts/2 00:00:00 grep --colour=auto workspace-wall-change
jimwg@bluemint1 ~ $

I wish I knew were in the command chain it is broken. Could be because I'm concurrently running other things in the background or have other user accounts as well? Or that I'm running Xfce which is fully installed on a flash drive? I'm just a newbie running all the angles! Thanks for putting up!
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

ToZ wrote:

Here is what I want you to do:
1. Kill the running process:

killall workspace-wall-change

2. Copy and Paste the debug version above in place of the last script and save the file.
3. Open a terminal window and run:

workspace-wall-change

...depending on where you saved it, you may need to specify the whole path to the script.
4. Change to another workspace then change back.
5. Press Ctrl+C in the terminal window to terminate the program.
6. Post back the contents of /tmp/wspmDEBUG.
=================================================================================


I can't even seem to get to first base here. Is it acting like it can't even find workspace-wall-change to work on it?

jimwg@bluemint1 ~ $ killall workspace-wall-change
workspace-wall-change: no process found
jimwg@bluemint1 ~ $ file:///home/jimwg/.scripts/workspace-wall-change
bash: file:///home/jimwg/.scripts/workspace-wall-change: No such file or directory
jimwg@bluemint1 ~ $
jimwg@bluemint1 ~ $ killall /home/jimwg/.scripts/workspace-wall-change
/home/jimwg/.scripts/workspace-wall-change: no process found
jimwg@bluemint1 ~ $ /home/jimwg/.scripts/workspace-wall-change
Lock failed - exit
jimwg@bluemint1 ~ $ cd /home/jimwg/.scripts/workspace-wall-change
bash: cd: /home/jimwg/.scripts/workspace-wall-change: Not a directory
jimwg@bluemint1 ~ $ cd /home/jimwg/.scripts/workspace-wall-change
bash: cd: /home/jimwg/.scripts/workspace-wall-change: Not a directory
jimwg@bluemint1 ~ $ cd /home/jimwg/.scripts/
jimwg@bluemint1 ~/.scripts $ killall workspace-wall-change
workspace-wall-change: no process found
jimwg@bluemint1 ~/.scripts $ workspace-wall-change
workspace-wall-change: command not found
jimwg@bluemint1 ~/.scripts $ workspace-wall-change
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

ToZ wrote:

jimwg@bluemint1 ~ $ /home/jimwg/.scripts/workspace-wall-change
Lock failed - exit

Either:
1. workspace-wall-change is running,
2. another version of this script (possibly called something else) has a hold on the lock file, or
3. the lock file is stale (which shouldn't have happened).

Did you run a version of this script under a different name and is it possible that it is still running? If so, then "killall <that_name>".

Otherwise, try this:

First, make sure the script isn't running:

killall workspace-wall-change

...then try deleting the lock file:

rm /tmp/.wspm.lockfile

...then try running the script again:

/home/jimwg/.scripts/workspace-wall-change

====================================

Okay, appears that the deleting lock file trick was the one to get it going! Looks good, but just some heads-up if there was any side-effects to all this troubleshooting. On first boot-up (Xfce fully installed on flash drive BTW if it matters) I received alerts that might have nothing to do with this wallpaper issue in case of coincidence but just thought you ought know;

On the first screen I made it on a fresh new XFCE screen since other session choices seemed deleted. A alert from Dropbox, first saying that it had error mounted in the wrong place then shortly after asking me to reauthorize. Same warning from Web browser, acting like briefly didn't want to load. Didn't repeat after second boot, but during second boot got this:

/dev/sdb1: Unexpected inconsistency. Run FSCK manually. Mountall: filesystem has errors. Skipping mounting since Plymouth not available. /dev/sdb1: Inodes that were part of a corrupted orphan linked list found.

I let it run through and clear itself up. Seems okay so far. I'll keep you abreast on this progress. Again, these might have nothing to do with the workspace-wallpaper issue, just an under-maintained drive

A few things for your talents to consider: Is there anyway to scale/re-size each workspace image independently? And any optional way to have a workspace run the desktop wallpaper slideshow list?

Good job!

Jim in NYC
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

Glad to hear you got it working. Just a heads up, make sure you are not running the DEBUG version of the script - the log file will fill up quickly using up valuable disk space.

I do not believe this script has anything to do with the messages you received - they are just not related.

A few things for your talents to consider: Is there anyway to scale/re-size each workspace image independently?

What exactly do you mean by "scale/re-size each workspace image independently"? In the desktop settings dialog you can specify the style (auto, centered, tiled, stretched, scaled, zoomed) for the images, or are you thinking that you would like to specify a different style for each wallpaper?

And any optional way to have a workspace run the desktop wallpaper slideshow list?

Yes. For the workspace that you want the slide show, set the image to "/home/jimwg/.config/xfce4/desktop/backdrop.list". Of course, you will have to have created the backdrop list first. You should be able to create other indepedent backdrop lists and specify them as well. Look at the content and format of the default one and create your own based on it (e.g. backdrop1.list backdrop2.list, etc)

Time permitting, I'll have a look and see what I can do.

Offline
#21 Today 15:03:41

ToZ
Member
Registered: 2011-06-02
Posts: 264

Re: Different Desktop Backgrounds Not XFCE Possible?

Okay. Here is the next version. Changes include:

1. You don't have to specify the number of workspaces anymore. It was redundant. The script will cycle through all existing ones.
2. I've added 3 configuration parameters for each workspace:
- WALL = the image name or the name of the backdrop list file (for the slideshow)
- STYLE = the image style (0=auto, 1=centered, 2=tiled, 3=stretched, 4=scaled, 5=zoomed)
- CYCLETIMER = if a backdrop list is specified, the time in munites to cycle the images.
3. I've removed the confusion regarding workspaces numbers and the way wmctrl handles workspaces. Workspace #1 is workspace #1. The wmctrl conversion is handled internally by the script.

To upgrade from version 1:
1. "killall <script>" (where <script> is the name of the currently running script)
2. copy/paste/save the script over the existing one
3. start it up again.

To install new:
1. save the code below to a file (e.g. $HOME/bin/wspm)
2. make the file executable
3. start it manually when you want to use it or add it to your startup applications for automatic use.

Here is version 2:

#!/bin/bash
# The Poor Man's Desktop/Workspace solution (version 2)
# Requires: wmctrl
# Make sure you edit the WORKSPACE configuration parameters to suit.

# make sure that only one instance of this script is running
lockfile=/tmp/.wspm.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
echo "wspmDEBUG: Locking succeeded" >&2

######### EDIT THESE VALUES #########################################################################
###
### WORKSPACE_WALL -> image file or backdrop list (slideshow images)
### WORKSPACE_STYLE -> 0=auto, 1=centered, 2=tiled, 3=stretched, 4=scaled, 5=zoomed
### WORKSPACE_CYCLETIMER -> for background slideshow, spceify how often in minutes to cycle image
###
### Note: You need one set of configuration parameters for each available workspace
###
### Workspace #1
WORKSPACE_WALL[1]="/home/toz/Pictures/avatars/avatar.png"
WORKSPACE_STYLE[1]=1
WORKSPACE_CYCLETIMER[1]=0
### Workspace #2
WORKSPACE_WALL[2]="/home/toz/Pictures/avatars/avatar.png"
WORKSPACE_STYLE[2]=2
WORKSPACE_CYCLETIMER[2]=0
### Workspace #3
WORKSPACE_WALL[3]="/home/toz/Pictures/avatars/avatar.png"
WORKSPACE_STYLE[3]=3
WORKSPACE_CYCLETIMER[3]=0
### Workspace #4
WORKSPACE_WALL[4]="/home/toz/.config/xfce4/desktop/backdrop.list"
WORKSPACE_STYLE[4]=0
WORKSPACE_CYCLETIMER[4]=1
#####################################################################################################

######### DO NOT EDIT BELOW #########################################################################
CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${WORKSPACE_WALL[$CURRENT_WORKSPACE]}"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s "${WORKSPACE_STYLE[$CURRENT_WORKSPACE]}"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/backdrop-cycle-timer -s "${WORKSPACE_CYCLETIMER[$CURRENT_WORKSPACE]}"

while true
do
sleep 1
NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
wmctrl -s $(($NEW_WORKSPACE)-1)
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${WORKSPACE_WALL[$NEW_WORKSPACE]}"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s "${WORKSPACE_STYLE[$NEW_WORKSPACE]}"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/backdrop-cycle-timer -s "${WORKSPACE_CYCLETIMER[$NEW_WORKSPACE]}"
CURRENT_WORKSPACE=$NEW_WORKSPACE
fi
done

rm -f "$lockfile"
else
echo "wspmDEBUG: Lock failed - exit" >&2
exit 1
fi

Last edited by ToZ (Today 15:05:31)
jimwg

Re: Different Backgrounds On Different Desktops Not Possible

Post by jimwg »

ToZ

Have you offered up your script to the XFCE community yet? Many seem under the illusion that you need KDE to do what it does!

Jim in NYC
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds On Different Desktops Not Possible?

Post by dj1s »

Updated 2022 Mar 07.

I have a simpler solution that works on Linux Mint 20.x Cinnamon, Mate and XFCE.
For more details, I created a Tutorial [SOLVED] Different Backgrounds, Icons on Different Workspaces (LM20.x Cinn, Mate, XFCE) at viewtopic.php?f=42&t=360221

After following the simple detailed instructions, you can customize each Workspace with both Desktop icons and background.
To switch Workspace/Desk, simply select Alt-1 for Desk1, Alt-2 for Desk2, etc.
To switch backgrounds, simply use the default background switcher. (Edited 2021 Oct 30. On re-reading this months later, I can see how one might think I was suggesting that you'd have to manually switch backgrounds every time you switch workspaces. That interpretation is not correct. When you switch workspaces using my script, each workspace "remembers" and restores both its own background and its own desktop icons as they were at the last time you left the workspace. What I meant by my pre-edit statement was that the method to change backgrounds, the one that will be "remembered", involves using the default background switcher; no need to edit scripts to change background)
Locked

Return to “Xfce”