Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a GUI application which starts with a shell script. How can I create an icon in the Unity dock by providing the shell script and an .svg icon?

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted
+50

You need to make a shortcut-file. Shortcuts for the Unity dock are located in ~/.local/share/applications/

  1. Create a file myGUIapp.desktop in that directory.

  2. Paste the following into that file (with correct paths for icon and shellscript):

    [Desktop Entry]
    Name=My GUI App
    Exec=/path/to/shellscript.sh
    Icon=/path/to/you/icon.svg
    Terminal=false
    Type=Application
    StartupNotify=true

  3. Make the file executable:

    Right click -> Properties -> Permissions -> Tick ‘Allow executing as a program’

  4. Restart Unity (or drag the file to the Dock to get it there directly).

Look in other files in ~/.local/share/applications/ to get an idea of how they should look. More info is available in this blog entry.

Edit:
If you want the shortcut to be accessable to all users you should check out Ubuntu packaging guide about icons.
Basically the .desktop-file are installed or moved to /usr/share/applications/<binary>.desktop instead and icons are placed in /usr/share/icons/hicolor/scalable/apps

share|improve this answer
    
So my application should provide this file and the user should drag it to the Dock? Does the file allows to use relative paths for exec and icon? –  Mike L. Oct 24 '11 at 10:20
    
Ah, I didn't catch that you were making an application for others to use. I have updated my answer to include that. –  micke Oct 24 '11 at 13:32
    
Is there not a simple GUI app that can edit the Unity menu yet? –  dave1010 May 1 '12 at 16:26
1  
Yes there is! Quicklist Editor for Unity. It's not that stable yet. –  micke May 1 '12 at 18:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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