Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-07-01 05:39:38

dj1s
Member
Registered: 2020-07-01
Posts: 2

[SOLVED] Customizing Workspaces with Background and Desktop Icons

Customize background and Desktop Icons for Workspaces

I've been searching for some time for someone to come up with a solution for showing icons and backgrounds unique to a Workspace. I finally came up with my own. This is my first posting, so I will introduce myself simply as a retired software developer and QA who has only recently re-acquainted myself with Linux.

Below was tested on Linux Mint 19.3, Cinnamon, 64 bit
This post is modified from a post I wrote on LinuxMint.com:
https://forums.linuxmint.com/viewtopic. … 7#p1831517
If this is considered cross-posting, then I apologize. However, I had been looking for a solution for some time, and I know other people have been looking too.

My initial implementation separated Desktop icons and backgrounds from the Workspace. This was a different resolution to the desire for having separate backgrounds and icons per Workspace. Conceptually, I could have a Home set of desktop icons and a Work set of icons - and switch according to my activities. So, if I was working (Ha Ha, I'm retired), I could switch to my work related desk and have all of the Workspaces available with only work related icons and background displayed. Then, when it's time to play, I could switch to my games related desk. After a short time experimenting with my first script, I settled on switching the Workspace along with the background and Desktop.

Changes from one Desktop to another are quick because I use symbolic links for switching Desktops and backgrounds.

To change Backgrounds for a Desk, simply use the default Background switcher. The script below saves the new background in a link file on the Desk upon switching to another Desktop. (If you reboot before switching, then the new background will not be saved.)

You sometimes have to be careful switching Desktops. If you start to edit a file on Desk 1 but switch to Desk 2 and save there, the saved file may not be where you expect (Depends on whether the file path uses Desktop or the target of Desktop.)

Step 1 - Change Desktop to a symbolic link. Preserve original Desktop folder contents in Desk1.
cd ~
mv Desktop Desk1
sudo rmdir Desktop
sudo ln -s Desktop

Step 2 - Create folders for other Desks.
Be careful not to re-create Desk1!
mkdir Desk2
mkdir Desk3
...
Move or copy icons from Desk1 to other Desk folders as desired.

Step3 - Create bash script to switch Desks.
With your favourite text editor, create switch-desk in your $HOME folder.

#!/bin/bash
#This script changes Workspace, Background and Desktop Icons
#Author: dj1s 2020 June
xdotool set_desktop $(($1-1)) 
BG=$(gsettings get org.cinnamon.desktop.background picture-uri)
Desk=$(readlink ~/Desktop)
ln -sfn $BG $Desk/background
Desk=~/Desk$1
ln -sfn $Desk ~/Desktop
BG=$(readlink $Desk/background)
gsettings set org.cinnamon.desktop.background picture-uri $BG
gsettings set org.nemo.desktop desktop-layout 'false::false'
gsettings set org.nemo.desktop desktop-layout 'true::false'

Save as switch-desk in your $HOME folder (or any other place...). Open properties of switch-desk and make it executable.

Step 4 - Make keyboard shortcuts.
Note that switch-desk requires a Desk identifier as its first and only argument.
Open Keyboard utility and select Shortcuts tab.
Select category Custom Shortcuts
Add Keyboard shortcuts. e.g.,
"Home Desktop" with command ~/switch-desk 1 and binding Alt+1
"Work Desktop" with command ~/switch-desk 2 and binding Alt+2
"Games Desktop" with command ~/switch-desk 3 and binding Alt+3
Replace "~" with full explicit path, because "~" won't work.
(Also, I tried binding with the Super/Windows key, but it didn't work right)

Step 5 - Try it out!
Initially, you were likely on Desk 1. Change its background using the default Change Desktop Background utility from the Desktop menu.
Alt+2 will take you to Desk 2. Notice that the icons on Desk 2 now match what you selected at Step 2 above. While on Desk 2, change its Background. 
Return to Desk 1 by way of Alt+1. Notice that the background changes to the one you selected for Desk 1.
Go back to Desk 2.  Notice that the background changes to the one you selected for Desk 2.
Repeat for other Desks you wish to configure.
Notice as well that you can still change Workspaces without changing background or desktop by using the Ctrl+Alt+arrow keys as before. This may be useful if, for example, you wish to use more than one Workspace during Work, using your Work Desktop for all Workspaces. I use a panel app called "Workspace Name" to display the Workspace number.

There is another "Gotcha" to be aware of. If you have a file on Desk 1 and you want to copy or move it to Desk 2, it won't work. By the time you are on Desk 2, the file you were trying to paste is no longer available because it is looking for it in the Desktop and the Desktop link changed from Desk 1 to Desk 2. You have to use the Files utility to move files from one Desk to another.

Note 1
When a parameter is changed via gsettings, affected systems update immediately.
The GNOME database changes over time. gsettings can list elements of the GNOME database.
When I upgraded from Linux Mint 19.1 to 19.3, I had to change some of the schema paths.

Last edited by dj1s (2020-07-01 05:54:34)

Offline

#2 2020-07-01 11:10:16

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 253

Re: [SOLVED] Customizing Workspaces with Background and Desktop Icons

I don't know. It seems like a lot of work just to put icons on a desktop. Myself, one of the first things I do is remove icons from the desktop after I install. Are you adding pieces of the cinnamon desktop or is this just something with mint. I don't have any of that. Also ALT-1,2,3 etc switches browser tabs for me. A useful default setting. To switch desktops has always been CTL-ALT-ARROW(L+R). The Super/Windows key is usually the Desktop menu.


Siduction
Debian Sid
Xfce 4.14

Offline

#3 2020-07-01 12:25:14

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 7,281

Re: [SOLVED] Customizing Workspaces with Background and Desktop Icons

dj1s wrote:

I've been searching for some time for someone to come up with a solution for showing icons and backgrounds unique to a Workspace.

See: https://forum.xfce.org/viewtopic.php?id=11066.

Below was tested on Linux Mint 19.3, Cinnamon, 64 bit

But this is an Xfce forum. Neither gsettings nor nemo are used in the default Xfce environment.

Perhaps this best belongs on a Cinnamon forum.

Offline

#4 2020-07-01 17:33:56

dj1s
Member
Registered: 2020-07-01
Posts: 2

Re: [SOLVED] Customizing Workspaces with Background and Desktop Icons

Ok, I understand now that a solution for LinuxMint Cinnamon may not be directly applicable to XFCE. However, I believe the idea of using symbolic links is transferable. Maybe someone can see if there are appropriate command-line replacements of gsettings to update background and Desktop.

I am trying to share my script - others are more than welcome to modify it and make it work in other environments.

Offline

Board footer

Powered by FluxBB