7 years ago
So I have files in different folders that I use, and it is nice to access them easily. I was looking if there was a way to switch both virtual workspaces and the desktop folder associated with each workspace, and I stumbled upon this: http://ubuntuforums.org/showthread.php?t=1651769
However, I've edited it somewhat for XFCE and made it more simple.
To make this work you do the following.
In ~/.config/ there is a file called user-dirs.dirs. If you look at this file, you will see this specifies your normal desktop folder as well as other folders. Now, the idea is to create more of these files, each specifying a different desktop depending what desktop you want. So in .config, create the following folders: "desktop1", "desktop2", "desktop3", and "desktop4". In each folder, copy the file user-dirs.dirs, and then change that file. You'll edit the path you want the desktop to be in the following sentence: XDG_DESKTOP_DIR="$HOME/.... You could then change this to, for example, XDG_DESKTOP_DIR="$HOME/Documents/study" or XDG_DESKTOP_DIR="$HOME/Pictures" - whatever you want. Do this for each of the user-dirs.dirs files in each desktop folder.
Then put the following scripts wherever you want them - personally I like putting them in a personal ~/bin/ folder:
For the script "desktop1" ( you can also name them differently if you like):
cp ~/.config/desktop1/user-dirs.dirs ~/.config/;
wmctrl -s 0;
xfdesktop -R &
cp ~/.config/desktop2/user-dirs.dirs ~/.config/;
wmctrl -s 1;
xfdesktop -R &
cp ~/.config/desktop3/user-dirs.dirs ~/.config/;
wmctrl -s 2;
xfdesktop -R &
cp ~/.config/desktop4/user-dirs.dirs ~/.config/;
wmctrl -s 3;
xfdesktop -R &
Just want to switch folders, and not workspaces? You can get rid of the wmctrl line. (line number 4 in each script).
Give your scripts executable permissions. You can either do this the GUI way by right-clicking the file, selecting permissions and allowing to execute it as a program, or (what I personally prefer), going to the folder that contains the scripts in terminal:
chmod +x desktop*
This will make all files containing the word desktop at the front in this folder executable.
Now you can test the scripts in terminal, e.g.:
And you should see the desktop changing.
What I have done is made launchers for each of these scripts. You can do this through "Menu Editor" or add launchers on the panel. (But I won't go into detail about how to create launchers here..., if you don't know google is your friend ;) ) I made launchers through "menu editor" and subsequently added them to plank ( a kind of dock).
Basically what the script above does is very simple. It copies your specific configuration file for a certain desktop to the .config directory and overwrites the general configuration file user-dirs.dirs. This then changes which file to use for the desktop. It then quits the desktop (don't worry, you won't see the screen going black or anything), moves to a different workspace, and restarts the desktop - which then loads the new settings.
To be honest, now I've figured it out, I don't think the script really makes things easier for me right now (I was already using other workarounds to easily access my folders), but then there aren't that many files I'm using at present. Still, I think it's sort of cool, and the script works well.
Oh yes if anyone can figure out how to change this for cinnamon, do let people know in the comments :) I use xfce, but I assume there is probably a way to make it work for cinnamon (and MATE) as well :)
A more accurate title for this tutorial would be “Switch the Folders on the Desktop According to Chosen Workspace”…
It’s hard to do for Cinnamon by the way since it has no command similar to xfdesktop as far as I know.
ok say "sacrificial anode" then ;-)
... weired (multiple Desktop folders - sounds like a bug caused by the hack (??)- but very interesting
will try out on my "victim-Machine" ;-)
Thanks, well I got it to work just this last week with the scripts I made loosely based on and inspired by the scripts on the other webpage (from 2010). You can see the scripts in the tutorial :) Yes, different desktop folders per workspace, as long as you link the script to launchers (or to key shortcuts) and use those to switch desktops. Using the workspace switcher in the panel won't do it.
the link is from 2010,
is it still working in 2015 - did you try out ?
very interesting issue, btw
so, you say
every Workspace has its own Desktop-Folder; seriously ?
Or did I got it wrong ?