HOWTO: Place programs on LXDE Desktop
Purpose: In our last post on LXDE, we saw how to auto-start a script/program in LXDE as soon as the user logs in. Now in this post, we will learn how to place our own custom programs on LXDE desktop. You must have noticed that you simply cannot drag-and-drop programs on LXDE desktop.
As mentioned earlier that the “.desktop” files are the most important files in LXDE if you want to do a lot of customizations. We will achieve our goal using the “.desktop” file. Let’s assume that you want to place a text file on your desktop which you can double click to open it. Further let’s assume that your text file resides at “/root/” directory.
Step 1: Create a text file
# nano README.TXT
Contents:
Hello, How are you today?
Save and exit.
Step 2: Create a corresponding .desktop file
Now we will create a corresponding .desktop file for the text file that we created in Step 1. Note that all the .desktop file will reside in the /usr/share/applications folder.
# cd /usr/share/applications/
# nano README.desktop
and type the following contents:
[Desktop Entry]
Encoding=UTF-8
Name= README
Comment= My README file
Exec=lxterminal --command "less /root/README.TXT"
Icon=/usr/share/pixmaps/readme.xpm
MimeType=text/plain
Terminal=false
Type=Application
MimeType=text/plain
Categories=Utility
Save and exit.
Let’s take a moment and understand what is going on in the above file:
Name - Give any name you want
Comment – Your own comment
Exec – Basically we are telling which program to use to open our text file. In this case we are opening the text file with “less” command in the lxterminal window. You could have also given the following:
Exec=leafpad /root/README.TXT
Icon – I copied my own icon, readme.xpm, in the “/usr/share/pixmaps” directory. You can do the same or just use the default icons that are available in that directory.
Rest all the fields should generally remain the same.
Step 3: Create a “Desktop” directory
Now we will create a directory called “Desktop” in the user’s home directory. So for example, if the user is “root”, then we will create the directory as follow:
# cd;
# mkdir Desktop
If your user is at “/home/kushalk”, then you would create the directory as follow:
# mkdir /home/kushalk/Desktop
Step 4: Link the .desktop file with Desktop folder
This is the last piece of puzzle which will bring everything together. Now all we need to do is to link the “.desktop” file created in Step 2 inside the “Desktop” directory created in Step 3.
# cd;
# cd Desktop
# ln -s /usr/share/applications/README.desktop .
That’s it. As soon as you give the above coomand, an icon should appear on your Desktop. In case if the icon still does not appear, simply logout from LXDE and log back in.
Happy LXDE’ing!

Free Email Subscription









September 13th, 2009 at 7:34 am
[...] Your Network With an Open-Source Firewall How To: Change The GNOME Menu Bar Icon HOWTO: Place programs on LXDE Desktop cpulimit – Limit the cpu usage of a [...]
February 8th, 2010 at 10:15 am
damn – do I really have to type all this just for a desktop icon?
windows has “paste as shortcut”.. and your done !
Reply to this comment
April 7th, 2010 at 5:07 am
Desktop items for command line programs where Terminal=true don’t work, clicking icon nothing happens. Same .desktop file works fine as a menu definition. Non-command line progs with Terminal=false are OK.
Experience this problem with different distros.
Any idea to fix?
Reply to this comment
mule.ear Reply:
July 27th, 2010 at 9:39 am
Bela –
It’s a little late, but how about xterm -e
I just tried it to make sure, and the app (links in this example) starts just fine. I tried it with ‘ls’ but it finished so quick I couldn”t see for sure that it worked.
[Desktop Entry]
Name=xterm-links
Type=Application
Comment=an xterm links trial
Exec=xterm -e links
TryExec=xterm -e links
Icon=
Categories=Utility;
Reply to this comment