10

I recently downloaded IntelliJ IDEA and start the app by running . idea.sh. The app appears in the launcher while I'm running it, but for some reason when I right click on it I don't get a 'Lock to Launcher' option like I do with other apps.

How do I attach it to the launcher?

Is it because I'm running a script and not an executable directly that disables that option?

14

There looks to be 2 ways you can do this.

Method #1: manually create .desktop file

Yes you need to create a custom .desktop launcher for it. Here are the general steps:

  1. Create *.desktop file in /usr/local/share/applications (or /usr/share/applications depending upon your system).

    $ gksudo gedit <insert-path-to-new-file.desktop>
    
  2. Paste below text

    [Desktop Entry]
    Type=Application
    Terminal=false
    Name=IntelliJ IDEA
    Icon=/path/to/icon/icon.svg
    Exec=/path/to/file/idea.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 the .desktop file into the Unity Launcher panel. For this step you'll need to navigate in a file browser to where the .desktop file is that you created in the previous steps. After locating the file, drag the file to the Unity Launcher bar on the side. After making doing this you may need to run the following command to get your system to recognize the newly added .desktop file.

    $ sudo update-desktop-database
    

Method #2: GUI method

Instead of manually creating the .desktop file you can summon a GUI to help assist in doing this.

  1. install gnome-panel

    $ sudo apt-get install --no-install-recommends gnome-panel
    
  2. launch the .desktop GUI generator

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

                      ss of editor

References

  • sudo update-desktop-databas should be sudo update-desktop-database – Trindaz Jun 27 '13 at 3:57
  • Also, the final line of Method #1 ($ sudo ...) shouldn't be there. After some guesswork I discovered that "Put this in unity panel" = Open the file browser and find the file created in step 1, then drag it to the "Launcher". "Panel" seems to be an ambiguous term in Unity depending on who you talk to. – Trindaz Jun 27 '13 at 4:02
  • @Trindaz - yes sorry for the lack of details I wasn't sure exactly how to do that step either in looking at another tutorial that same step was just as vague. I'll add the details as you described in that step. LMK if they look OK. – slm Jun 27 '13 at 4:05
  • This worked for my on 18.04 but trying on 19.04 and the configuration file opens as a text file! What a pain. – Quaternion May 10 at 19:43
0

The following is usable in my case, launching a shell script from a launcher, and keep the shell window open.

This example is with mate-terminal, use gnome-terminal if it's the one on your system.

This example is with a php cli shell script, to get the idea, any command can be passed here.

One parameter is passed to the script, -h on this case.

Adding ; bash keep the shell window open, after the end of the script.

mate-terminal --execute bash -c "php /home/lilith/Desktop/moon/MOON/moon -h ; bash"

To keep the window open, with the path set on the script folder, use cd before the command:

mate-terminal --execute bash -c "cd /home/lilith/Desktop/moon/MOON/ && php moon -h ; bash" 

This allow to launch some more commands directly, without carrying of paths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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