Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
Runtoyru
Level 1
Level 1
Posts: 2
Joined: Thu Mar 21, 2024 4:12 am

Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Runtoyru »

Hi,

First, I've tried your solution : Thank you very much ! I'm a developer and it is a such a good solution. I can't understand why it is not part of Linux Mint. Your discussion with "experts" seems to be as I heard every day : it's not my fault, the system is like this ! ... and why are you developer if it is not to move things !
Second, I have something weird about my install. When I switch to Desktop 1, it is always with the wallpaper of the last desktop. I lost always the wallpaper of the desktop1. So, after few days, I decided to figure out why. I'm not sure to understand the way it works, but as I'm old French guy, I use a French version of Linux Mint (21.3) and "Desktop" doesn't exist, "Bureau" yes. If I remember the installation of your script, I had an error the first time I tried :
mv Desktop Desk1; ln -sfn Desk1 Desktop

Could it be the problem, and if it is, how do I correct it ?

Thank for your help :)

Antoine
Last edited by SMG on Fri Mar 22, 2024 1:10 pm, edited 1 time in total.
Reason: Split from https://forums.linuxmint.com/viewtopic.php?t=360221 whichi is a tutorial.
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: [SOLVED] Different Backgrounds, Desktop Icons for Different Workspaces (LM20.x, LM21.x Cinn, Mate, XFCE)

Post by dj1s »

As I don't have a French version, I can only suggest that you replace references to "Desktop" in my tutorial and scripts with "Bureau", assuming that is the French equivalent to the Desktop folder. It should not be difficult for a developer such as yourself to figure out.

My outstanding concern is that there may be differences in gsettings. Probably not, but...
Runtoyru
Level 1
Level 1
Posts: 2
Joined: Thu Mar 21, 2024 4:12 am

Re: [SOLVED] Different Backgrounds, Desktop Icons for Different Workspaces (LM20.x, LM21.x Cinn, Mate, XFCE)

Post by Runtoyru »

Hello,

Thank you for your answer !
So my situation is :
  • Desk1 is a link to itself ( :( )
  • Desktop is a link to Desk1 ( :oops: ) or Desk2, Desk3 or Desk4 (they are directories : ok).
  • Bureau is my initial "Desktop directory" because I have french version of Linux Mint (21.3, Cinnamon) 8)
  • When I switch to desktop 1, it keeps the last background (but it works :shock: , how ?)
So, I test this :
  • Switch to Desktop3 (it could have been 2 or 4, but not 1)
  • Delete the link Desk1... that's why the Desktop link must be on Desk2, 3 or 4
  • Rename Bureau to Desk1
Results :
  • I have a different background for each Desktop : YES ! I can switch Yes ! Yes ! Yes !
  • I "lost" all my specific icons (generics are present on all desktops). They are in the physical directories but not "visible" on the desktop.
Next step : well, any idea for my icons ? I just don't know how it should works with specific icons...

Thanks,
Antoine
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: [SOLVED] Different Backgrounds, Desktop Icons for Different Workspaces (LM20.x, LM21.x Cinn, Mate, XFCE)

Post by dj1s »

What others have done is reinstalled linux and followed the tutorial exactly.
I don't think that is necessary, but you might have already lost the contents of your Bureau folder.
Step 1 assumes Desk1 folder does not exist. If it does, rename it.

[Step 1]
cd ~
mv Bureau Desk1; ln -sfn Desk1 Bureau

[Step 3]
In the switch-desk script, replace the two "Desktop" (in the ln commands, with capital D only) with "Bureau".

Obviously, this may be the wrong remedy, but it is my best guess as to the solution based on what I understand from what you wrote.
ThetaGamma
Level 1
Level 1
Posts: 1
Joined: Wed Mar 27, 2024 12:44 pm

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by ThetaGamma »

Dear all
I like this simple solution and as I'm a german user I experienced some similar problem as our french friend @Runtoyru (we have "Schreibtisch" not "Desktop")

To improve this, I first wrote a script that makes the initial setup process a little more newbie-proof. It also incorporates necessary changes to take care of internationalization

you can find it here https://gitlab.com/thetagamma11/switch-desk
Feedback/Bugreports very welcome

Best
TG
Last edited by ThetaGamma on Thu Mar 28, 2024 5:04 pm, edited 1 time in total.
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by dj1s »

I have updated my tutorial and scripts to automatically use the correct name and location of the Desktop if your language is not English

See [SOLVED] Different Backgrounds, Desktop Icons for Different Workspaces (LM20.x, LM21.x Cinn, Mate, XFCE)
viewtopic.php?t=360221
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

I have followed the tutorial and things did not go as expected:

Code: Select all

logansfury@HP-Z220-SFF-Workstation:~$ cd ~
logansfury@HP-Z220-SFF-Workstation:~$ Desk=$(xdg-user-dir DESKTOP)
logansfury@HP-Z220-SFF-Workstation:~$ mv $Desk $Desk1; ln -sfn Desk1 $Desk
mv: missing destination file operand after '/home/logansfury/Desktop'
Try 'mv --help' for more information.
logansfury@HP-Z220-SFF-Workstation:~$ mkdir Desk2
logansfury@HP-Z220-SFF-Workstation:~$ mkdir Desk3
logansfury@HP-Z220-SFF-Workstation:~$ mkdir Desk4
logansfury@HP-Z220-SFF-Workstation:~$ dir
1		   Desktop			   Public
corectrl	   Documents			   python_work
corectrl-v1.3.9    Downloads			   Repeat
db_v2.sqlite3	   id_ed25519			   switch-desk.sh
db_v2.sqlite3-shm  id_ed25519.pub		   Templates
db_v2.sqlite3-wal  MakeMKV			   Videos
Desk2		   Music			   xdotool
Desk3		   Pictures
Desk4		   PlayOnLinux's\ virtual\ drives
logansfury@HP-Z220-SFF-Workstation:~$ chmod +x switch-desk.sh
logansfury@HP-Z220-SFF-Workstation:~$ ./switch-desk.sh
Invalid desktop ID.
Usage:
  gsettings [--schemadir SCHEMADIR] set SCHEMA[:PATH] KEY VALUE

Set the value of KEY to VALUE

Arguments:
  SCHEMADIR A directory to search for additional schemas
  SCHEMA    The name of the schema
  PATH      The path, for relocatable schemas
  KEY       The key within the schema
  VALUE     The value to set


logansfury@HP-Z220-SFF-Workstation:~$ 

I ended up with three items on my Desktop: background, Desk, and Desk1 All three icons show a text document with a Lock, an X and an upward-diagonal-right arrow image superimposed on them. Shouldn't these have gone into the home dir and not on my Desktop?

Can anyone explain where I went wrong? I am new to linux and not a coder so I am sorry if it is an obvious mistake to an experienced user.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by dj1s »

The answer to your issue is that your third line refers to $Desk1. $Desk1 is undefined. Should be just Desk1, without "$".

I just checked, and I had inadvertantly introduced $Desk1 in a recent change to the tutorial. Thanks for catching it!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

dj1s wrote: Wed Apr 03, 2024 1:22 pm The answer to your issue is that your third line refers to $Desk1. $Desk1 is undefined. Should be just Desk1, without "$".

I just checked, and I had inadvertantly introduced $Desk1 in a recent change to the tutorial. Thanks for catching it!
Far out, I'm glad you caught that typo :)

So do I delete the items generated on my desktop and rerun the terminal command properly or must I leave the items on my desktop alone?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

I went ahead and moved the desktop items to trash where they can be recovered if needed.

Something appears wrong with the switch-desk.sh:

Code: Select all

logansfury@HP-Z220-SFF-Workstation:~$ cd ~
logansfury@HP-Z220-SFF-Workstation:~$ Desk=$(xdg-user-dir DESKTOP)
logansfury@HP-Z220-SFF-Workstation:~$ mv $Desk Desk1; ln -sfn Desk1 $Desk
logansfury@HP-Z220-SFF-Workstation:~$ dir
1		   Desk2       id_ed25519.pub		       Repeat
corectrl	   Desk3       MakeMKV			       switch-desk.sh
corectrl-v1.3.9    Desk4       Music			       Templates
db_v2.sqlite3	   Desktop     Pictures			       Videos
db_v2.sqlite3-shm  Documents   PlayOnLinux's\ virtual\ drives  xdotool
db_v2.sqlite3-wal  Downloads   Public
Desk1		   id_ed25519  python_work
logansfury@HP-Z220-SFF-Workstation:~$ ./switch-desk.sh
Invalid desktop ID.
Usage:
  gsettings [--schemadir SCHEMADIR] set SCHEMA[:PATH] KEY VALUE

Set the value of KEY to VALUE

Arguments:
  SCHEMADIR A directory to search for additional schemas
  SCHEMA    The name of the schema
  PATH      The path, for relocatable schemas
  KEY       The key within the schema
  VALUE     The value to set


logansfury@HP-Z220-SFF-Workstation:~$ 

How do I get my switch-desk.sh to work please? I gave it permission to run with chmod already.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by dj1s »

Switch-desk requires a number as its first parameter. In the script this shows up as $1. This number is the number of the target Desk. So, if you want to run the switch-desk command manually in terminal to get to Desk2, run ./switch-desk.sh 2.
Otherwise, you'll see "Invalid desktop ID"
If you install the shortcuts as outlined in the tutorial, they pass the desktop id.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

It's working!

the terminal command with the number parameter is working perfectly and remembering assigned wallpapers.

I am going to continue with the tutorial and make the shortcuts
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

I followed directions to make the Alt + 1-4 shortcuts, but they error saying no such file found

I see the switch-desk.sh, but I do not see any code for desk 1, desk 2 etc.

Could you provide this please?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

I just made 4 brute force command line bash scripts:

desk 1

Code: Select all

#!/bin/bash

./switch-desk.sh 1
desk 2

Code: Select all

#!/bin/bash

./switch-desk.sh 2
etc.

They work fine in terminal, and double clicked, and I edited the alt + 1-4 shortcuts to point to them and the key combos work fine. The wallpapers are changing properly with each workstation change.

Is the background file I am seeing on the desktops only visible because I have show hidden files/folders enabled?
Last edited by Logansfury on Thu Apr 04, 2024 10:20 am, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

Is this only icons and wallpaper or can you use different themes like a dark red on one workspace and a dark blue on another?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by dj1s »

The background file could be named anything and located anywhere. So it could be named ".background" to hide, or one could create a ~/background/folder. The switch-desk script would have to be modified to find the new name or new location. I wrote a tutorial that works as claimed. The "student" should take it from there...

I know there are many improvements, but, as I have written before, this feature should be part of Linux Mint. My hope is that a top-level developer will take it from here.

With regard to the shortcuts not working: yes they do. The most likely error is with the path to your switch-desk. It must be explicit; no "~" or "$HOME". If you cut and paste to make each shortcut, don't forget to change the desk number argument for each one.

With regard to having different themes per workspace, I could probably figure out how to do it, but it does not interest me. Having different backgrounds was enough.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

I am having difficulty moving the background file off the Desktops.

I made directories Background1 - 4 and edited the script:

Code: Select all

#!/bin/bash
#Switch Workspace to $1 Workspace with its own Background and Desktop icons
cd ~
Desk=$(xdg-user-dir DESKTOP)  #Fetch location of Desktop.
BG=$(gsettings get org.cinnamon.desktop.background picture-uri)   #Get the current background path
ln -sfn $BG $Background/background   #Save the path as a soft link in background on Background# dir 
ln -sfn Desk$1 $Desk    #Make Desk$1 the new Desktop
wmctrl -s $(($1-1))  #Use wmctrl to switch Workspace (N.B., 1st workspace is 0)
BG=$(readlink Desk$1/background)  #Fetch the new background from the background soft link in Desk$1
gsettings set org.cinnamon.desktop.background picture-uri $BG  #Change the background in Desk$1
gsettings set org.nemo.desktop desktop-layout 'false::false'
gsettings set org.nemo.desktop desktop-layout 'true::false'
I am pretty sure I messed up line 6. Can anyone help fix this please?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by dj1s »

Sorry, but I led you astray.

I just remembered why I kept the background on the current desk. When we run switch-desk, we provide a parameter which tells it which desk should show next. We don't have the number for the current desk. So, where do you store the background of the current desk so it can be found when you return from any other desk? I would need to either store the current desk's number somewhere, or I'd have to fetch it like I do when switching right or left. I finessed having to know the current desk's number by keeping the background with the desk.

I recommend that you not worry about hiding the background until you have a deeper understanding how scripts work. That means reverting to the switch-desk from the tutorial.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by Logansfury »

dj1s wrote: Thu Apr 04, 2024 6:47 pm Sorry, but I led you astray.

I just remembered why I kept the background on the current desk. When we run switch-desk, we provide a parameter which tells it which desk should show next. We don't have the number for the current desk. So, where do you store the background of the current desk so it can be found when you return from any other desk? I would need to either store the current desk's number somewhere, or I'd have to fetch it like I do when switching right or left. I finessed having to know the current desk's number by keeping the background with the desk.

I recommend that you not worry about hiding the background until you have a deeper understanding how scripts work. That means reverting to the switch-desk from the tutorial.
I restored the switch-desk script. Once I realized some of your file examples were meant to be customized I got everything going for my system and every part of the project is working for me: the shortcuts bound to the alt + # keys all work, right and left bash scripts work, terminal commands work, and I am working on a conky/xdotool combo now to change between saved Desks by graphic button clicks.

I'm sorry to hear you aren't interested in enabling themes. It would make it possible to create drastically different GUIs on the different workspaces. I hope you reconsider sometime soon and present this to the forum!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
dj1s
Level 2
Level 2
Posts: 55
Joined: Fri Jun 19, 2020 5:21 pm
Location: BC, Canada

Re: Different Backgrounds, Desktop Icons for Different Workspaces LM21.3

Post by dj1s »

I reconsidered and I have written another Tutorial which supports themes as well as background and desktop icons. Still under testing...
See Switch Workspaces with own Desktop Icons, Background and Theme
viewtopic.php?t=417324
Post Reply

Return to “Software & Applications”