Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How can I edit/create new launcher items in Unity by hand?
How can I create launchers on my desktop?

I want to add some shell scripts in my launcher as shortcuts..

They are located deep inside and i have to navigate to it every time to execute them...

I tried this link where the 2nd answers seems to solvee it but as said in comments neither can i find any option to add a launcher..

I guess it existed in 11.04 with a "+" button on launcher but i use 12.04.

So how do i get this working?? And i need those commands everytime for sure..!

share|improve this question

marked as duplicate by Jorge Castro, Jjed, SirCharlo, Stephen Myall, Eliah Kagan Sep 1 '12 at 11:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Relevant link, the right click for creating launcher is now gone, askubuntu.com/questions/64222/… –  Mateo_ May 23 '12 at 23:10

2 Answers 2

up vote 45 down vote accepted

1.create *.desktop file in /usr/local/share/applications/ (or /usr/share/applications/ depending upon your system) if you want the launcher shortcut to be available to all users.

gksudo gedit </insert/path/to/new/file.desktop>

2.Paste below text

[Desktop Entry]
Type=Application
Terminal=true
Name=unmount-mount
Icon=/path/to/icon/icon.svg
Exec=/path/to/file/mount-unmount.sh

edit Icon= and Exec= and Name= *also Terminal=True/false determines weather the terminal opens a window and displays output or runs in the background

3.put this in unity panel by dragging it from files manager

logic is very simple that unity panel allows *.desktop files as launcher though I haven't tried because I use Natty.

share|improve this answer
    
there is no such directry called applications in /usr/local/share...should i make it?? –  Nirmik May 23 '12 at 15:54
4  
@Nirmik then try `/usr/share/applications/ –  virpara May 23 '12 at 15:58
    
i made a directory in /usr/lacal/share because i think by the location you are saying,the desktop file will become available for other users too n then they will also be able to mount using that desktop file shortcut..so i think it should be in local itself right?? –  Nirmik May 23 '12 at 16:00
    
okay it worked for a terminal exicuting .sh file...now i want to add another bash file which has a gui and thus is not "Run in terminal".how to do that?? i tried changing terminal=false but it did not work...what should i do?? –  Nirmik May 23 '12 at 16:15
    
@Nirmik Can you give me script? so I can play with it. –  virpara May 24 '12 at 8:05

What @vipara said is mostly correct, except that I also found /usr/local/share didn't work for me. Also, you will need to run sudo update-desktop-database after adding this file in order to refresh the launcher apps. Also, there is a much easier way to create the .desktop files. First, make sure you have the gnome-panel installed (it was pre-installed on my 12.04 Ubuntu):

sudo apt-get install --no-install-recommends gnome-panel

Once you have this command, then you can run:

gnome-desktop-item-edit ~/Desktop/ --create-new

This will bring up a nice GUI window where you can select the application, icon, etc. It will dump the .desktop file on your desktop (or wherever you direct it), so you'll still need to sudo mv it to the applications folder and update the desktop database afterwards

Launchers are saved in /home/myusername/.local/share/applications

share|improve this answer
1  
An Ubuntu 13.10, you don't have to do anything extra like you mentioned, gnome-desktop-item-edit does it for you, and it appears on you desktop automatically. –  xchg.ca Nov 8 '13 at 18:09
    
Sorry for the late reply : I've tried with IntellijIdea shell script, which I added into classpath, but in the desktop icon file WE MUST PUT THE ABSOLUTE PATH ! –  Laurent BERNABE May 13 at 6:44
    
In Ubuntu 14.x gnome-desktop-item-edit isn't pre-installed. After creating the desktop configuration file, just drag it to the launcher (Dock). (You can also select a custom icon: right-click the desktop configuration file, select Properties ..., click on the icon in the dialogue, select an image file.) –  Vincent Jul 21 at 9:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.