18

Possible Duplicate:
How can I create launchers on my desktop?
How to add a shell script to launcher as shortcut

I open my favourite IDE (PhpStorm) using a custom bash script. I would like to add the script to the Unity launcher.

I thought I could add it by clicking the "keep in launcher" option, and sure enough, the icon stays on the launcher after I close the app. But clicking the icon doesn't reopen the IDE - the launcher just sits there, flashing. When I relogin in, the launcher icon is gone.

Anyone got any ideas how I can make this work?

hippyjim
  • 599

4 Answers4

17

I created one for Gnome Screensaver, and saved it to: ~/.local/share/applications/

you may need to create this directory:

mkdir ~/.local/share/applications   (if required)

screensaver.desktop

[Desktop Entry]
Name=Activate Screensaver
Comment=
Exec=gnome-screensaver-command -a
Icon=screensaver
Terminal=false
Type=Application
StartupNotify=true

Then simply search in Dash for the 'Name', and move icon to launcher.

david6
  • 14,499
3

Use

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

in terminal to create a launcher in desktop. I've tried it in Ubuntu 12.04 and it works.

Actually, it works only if you have gnome-shell installed. But I have tried and found that even if only gnome-desktop-item-edit is present, it can still work.

jokerdino
  • 41,320
  • Unity desktop users may need to install gnome-panel which includes gnome-desktop-item-edit. Note that gnome-panel runs in the background. – noobninja Aug 20 '15 at 19:40
2

Launchers are *.desktop files, and making them is fairly easy. I do agree with you in that Unity should create a working launcher automatically, but in this case it looks like you will have to create the launcher yourself.

To create a launcher, just follow these steps:"

  1. Right click on your desktop, and select Create Launcher
  2. Name it as you like, and select for it the icon of your preference
  3. In the Location entry, enter the location to your *.sh script - remember that it must be executable or else the launcher will not be able to open your application
  4. The comment, needless to say, is optional to enter

Check out this guide on creating launchers for more information.

Once that you have your launcher working, move it to ~/.local/share/applications/ (where you will find other launchers perhaps), launch the application and pin it to Unity. I think it will work afterwards, if not let me know.

Severo Raz
  • 5,971
  • 3
    Thanks Wolter - unfortunately I'm stuck at the first hurdle - I can't find a "create launcher" option anywhere. – hippyjim Nov 08 '11 at 15:11
  • 1
    Update: I found out how to create a launcher here so at least i can reach the app now - but "pinning" to the unity panel still doesn't work. it stays there after the program is closed - but when I try to reopen, it just flashes for a few seconds, then nothing. After a log out & back in, the launcher is no longer pinned either – hippyjim Nov 08 '11 at 15:24
  • 1
    Ok, more - looks like this is a known bug: https://bugs.launchpad.net/ubuntu/+source/bamf/+bug/754334 – hippyjim Nov 08 '11 at 15:28
1

Not refuting the previous answers in any way, but there are a couple of other options you may or may not which to consider:

  • If you have too many icons in your launcher and you don't like the accordian effect, you can add multiple executables accessible through "right clicking" one icon. Search "unity shortcut group" or "unity quicklist" for lots of examples.

  • You can access scripts directly from your desktop via "right click" context menu. Search "Nautilus Scripts" for howtos and examples. These can be especially useful for context specific actions on objects you see/select in the nautilus filesystem browser (for example, I use scripts to "open a terminal here" and "Edit with VIM" a lot).

One solution is no better than the other ... just a few more options to consider depending on the specifics of what you want.

Eliah Kagan
  • 117,780
Don
  • 71