Lxde: How to create different icons(shortcuts) on the different desktops?
I already have configured different background pictures for each (virtual) desktop. I am signed in as user 'a', thus ~ = /home/a. I like being organized, and naturally the next step is to configure different icons(shortcuts) on the different desktops in lubuntu 14.04LTS. Natually being that android has different icons on different desktops, users will want this feature more and more when on lubuntu. Unfortunately when I google, not only does it seem that there isn't anyway configuration to do this, some people even claim that lxde can't have different icons on different desktops.
I then follow a tutorial
http://ubuntuforums.org/showthread.php?t=1651769 by ELRINDELL where each desktop has different icons. Due to Elrindell's desktop environment being quite different than lxde(1-gnome vs lxde; 2-avant-window-navigator has long been depreciated), I had to significantly modify some procedures/scripts, as shown below:
Code:
mkdir -p ~/Desktop1 ~/Desktop2 ~/.config/Desktop1 ~/.config/Desktop2;
cp /home/a/.config/pcmanfm/default/desktop-items-0.conf ~/.config/Desktop1;
cp /home/a/.config/pcmanfm/default/desktop-items-0.conf ~/.config/Desktop2;
gedit ~/bin/desktop1.sh ~/bin/desktop2.sh /home/a/.local/share/applications/Desktop1.desktop
/home/a/.local/share/applications/Desktop2.desktop;
sudo chmod +x ~/bin/desktop1.sh ~/bin/desktop2.sh;
I then display ~/Desktop in pcmanfm, and
1) Move the icons you want into your ~/Desktop1 folder, and the others to ~/Desktop2 folder.
2) Edit the changes you made in 1) above in both files:
>~/.config/Desktop1/ desktop-items-0.conf
>~/.config/Desktop2/ desktop-items-0.conf:
. a. Adjust to the wallpaper you want for that
Code:
wallpaper0=/home/Wallpaper/trees-in-the-sea.jpg
. b. At the last section are the shortcuts/links. For me, I only want 4 shortcuts on my desktop: Codeblocks for a pm environment(cb_pm.desktop), a folder(Man files), another desktop file (timemgmt.desktop), and a link to a spreadsheet(command.xls).
Code:
[cb_pm.desktop]
x=860
y=55
[Man files]
x=860
y=145
[timemgmt.desktop]
x=860
y=235
[command.xls]
x=860
y=325
After I make some final adjustments to the x,y coordinates of each shortcut to get them perfectly lined up, I then make my script which is based on elrindell's tutorial, where I paste the below into ~/bin/desktop1.sh and ~/bin/desktop2.sh, making the appropriate modifications for ~/bin/desktop2.sh:
Code:
#!/bin/bash
#TURN OFF DESKTOP
pcmanfm --desktop-off
sleep 0.5
#SWITCH DESKTOP ITEMS
#Delete current Desktop's set icons
rm -rfv ~/Desktop/.xls
rm -rfv ~/Desktop/phonebook.desktop
rm -rfv ~/Desktop/*~
#Copy over new icons
cp -dpr ~/Desktop1/* ~/Desktop #-d option to copy over link, not link's target file; -p same as --preserve=mode,ownership,timestamps;
#UPDATE DESKTOP CONF FILES
cp -p ~/.config/Desktop1/desktop-items-0.conf ~/.config/pcmanfm/default
cp -p ~/.config/Desktop1/desktop-items-0.conf ~/.config/pcmanfm/lubuntu
#RESTART DESKTOP
openbox --reconfigure
sleep 0.5
pcmanfm --desktop&
In order to add both *.sh applications to the Application launch bar within lxpanel for a 'click and go' GUI experience, I paste the following into the desktop files (Desktop1.desktop & Desktop2.desktop)
Code:
[Desktop Entry]
Type=Application
Name=Desktop1
Exec=/home/a/bin/desktop1.sh
Icon=/home/Icons/Desktop/Pencil_blue1.png
Categories=Graphics
Terminal=false
PROBLEMS:
The above really works quite well, except for the 2 following shortcomings:
1) Persistent shortcuts: Shortcuts added later, when not making the corresponding changes in Desktop1(or 2).sh and desktop-items-0.conf will keep appearing on both desktops. Having to change both of these files everytime you add a shortcut is rather onerous.
Attempt 01: At first I thought that the code above in desktop1.sh (and desktop2.sh, specifically first rm -rfv then cp -p) lacked flexibility, since when you add another file to the desktop, unless you make the corresponding changes in ~/.config/Desktop2/ desktop-items-0.conf, the later added in icons/folders/shortcuts/program launchers to the desktop will just be persistent shortcuts, and they will just remain on every desktop. Thus I thought to replace rm -rfv then cp -p with a move mv command(Idea #1).
Code:
mv ~/Desktop/* ~/Desktop2; #Moves contents of the display Desktop to Desktop2
mv ~/Desktop1/* ~/Desktop; #Moves contents of Desktop1 to the display Desktop
But in case the user inadvertently clicks on desktop1 two consecutive times, then the contents of desktop 2 are loaded into desktop1 while simultaneously the other desktop, which is empty (as of the completion of the program's first run) is loaded into the current desktop, producing an empty desktop.
Attempt 02: I then thought of another way of beating this 'persistent shortcuts' issue: Use rsync(Idea #2):
Code:
rsync -Savi -Eu -stat --delete ~/Desktop/* ~/Desktop1
rsync -Savi -Eu -stat --delete ~/.config/pcmanfm/default/desktop-items-0.conf ~/.config/Desktop1
Unfortunately the exact same problem happens again, as in idea #1 above. If you are currently in Desktop2, and you hit Desktop 2 again, then the 1st rsync command erases all the Desktop1's icons and then writes Desktop2's icons into the folder ~/Desktop1, which is supposed to backup Desktop1's icons.
And then the desktop-items-0.conf file for desktop2 will replace the *.conf file in .config/Desktop1!
2) The final problem is how the windows in lxpanel's Task Bar(Window List) don't change.
Does anyone have a better idea on how someone in lxde (specifically lubuntu) can have different icons on different desktops? Is there any way to solve the two shortcomings above?
Andrew