Creating Launcher for any executable file [Linux]
Most of the times its irritating to open a terminal, surf to particular directory and launch the script file or any other executable. Atleast for lazy people like me, I am totally fed to to type paths to directory and launch executables. So I just ‘googled’ this solution that just taught me to create a Unity launcher for any executable command you want to execute with just like some application and that to with feature like to open terminal, display icon, many more.
Basically there are two methods described on web. One is creating a desktop configuration file yourself and another creating it through a GUI ( finally something for ultimate lazy guys). Each one does a identical job.
Method 1: coding desktop configuration file
Check out the below template code. Replace the attributes as according to your need. Do not make a mistake to give some unknown or non-existing path as the icon would fail launching it without giving the error source or line.
[Desktop Entry] Version=x.y Name=ProgramName Comment=This is my comment Exec=/home/alex/Documents/exec.sh Icon=/home/alex/Pictures/icon.png Terminal=false Type=Application Categories=Utility;Application;
Version is the version of this .desktop file.
Name is the name of the application, like ‘VLC media player’
Comment is a phrase or two describing what this program does.
Exec is the path to the executable file.
Terminal field specifies whether the application should run in a terminal window or not.
Type field specifies the type of the launcher file.
Icon field is the icon that should be used by the launcher.
Categories is just some tags for application.
Further don’t forget to set its executable rights. By setting executable rights to your .desktop file, it automatically takes the specified Icon and Name (specified in the corresponding fields), as it should be. This can be done as going to properties ( right click the icon), enter permissions tab, and mark or check the box to run it as executable. That’s it. You now have a launcher for your executable file.
Method 2: Using Gnome-panel
Install the gnome-panel using following command
sudo apt-get install --no-install-recommends gnome-panel
Once installed, you are ready to go. Just launch gnome panel though console as
gnome-desktop-item-edit ~/Desktop/ --create-new
where ‘~/Desktop/’ is any directory you want your launcher to appear, after its creation process is over. After running this command, a familiar window will pop-up, which lets you fill the Name, the Command and the Comment for your launcher. Also, you can specify an icon for your launcher by clicking on the big icon of the window on the top left of it.
Simple and elegant. Though this methods are widely available over web, I just though to write the post directing solution straight to the point.