How To Create Launcher For Application? [duplicate]
Solution 1:
Ok, this is quite simple, what you want to create is a named file with a .desktop
extension with contents like this:
[Desktop Entry]
Name=Steam
Comment=Application for managing and playing games on Steam
Exec=/usr/bin/steam %U
Icon=steam
Terminal=false
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;
Actions=Store;Community;Library;Servers;Screenshots;News;Settings;BigPicture;Friends;
To create this file globally you can run your favorite text editor as root using sudo
, using the terminal application. If it's a graphical editor, keep your environment clean by adding the -H
flag:
sudo -H gedit
Browse to the /usr/share/applications/
directory. It should look something like this:
Select any .desktop
file, it should look something like the steam.desktop
example above. After you have edited it it should be close to this:
[Desktop Entry]
Name=Fritzing
Comment=
Exec=sh [link to file]
Icon=[link to icon(not required)]
Terminal=false
Type=Application
Categories=[choose what categories you want this file to fit into such as Game,Browser ext.]
It is important to note that the path to the files has to be the full path. Tilde expansion won't work so you can use ~/
paths. Also if you want to run your script as root you can add gksudo
(gksudo
has been removed from ubuntu as of 13.04, you can install it by running the command sudo apt-get install gksu
in the terminal) before the sh command on the Exec=
line.
Once you have saved your file, right click, go into properties, permissions and make sure that Allow executing as file is ticked. Then restart, it may not be required though.
Terminal way:
cd /usr/share/applications/
sudo -H gedit [your chosen desktop file]
or
sudo nano [your chosen desktop file]
Edit it then save as what you want to call it.
chmod a+x [your saved desktop file]
You may need to restart you pc
sudo reboot