Sunday, March 24, 2013

Create Intellij IDEA launcher on Ubuntu

If you develop using Intellij IDEA on Ubuntu, then it is handy to have launcher on unity panel. There are three relatively easy steps to make it happen:

1. Get current Unity launcher configuration

gsettings get com.canonical.Unity.Launcher favorites

Output:

['application://nautilus-home.desktop', 'application://firefox.desktop', 'unity://running-apps', 'unity://expo-icon', 'unity://devices']

2. Create IDEA desktop launcher

sudo vim /usr/share/applications/idea.desktop

Copy this content into the file and save it:

[Desktop Entry]
Name=Intellij IDEA 12
Comment=Development IDE
Exec=idea
Icon=/opt/idea12.0.4/bin/idea.png
Terminal=false
Type=Application
Categories=Development;IDE;
3. Update Unity launcher configuration

gsettings set com.canonical.Unity.Launcher favorites "['application://nautilus-home.desktop', 'application://idea.desktop', 'application://firefox.desktop', 'unity://running-apps', 'unity://expo-icon', 'unity://devices']"

Launcher is ready to be used

2 comments:

  1. Thanks for this post! Some slight modifications:

    1. I installed Idea to /opt/idea/idea-IU-
    2. I created a current softlink: ln -s idea-IU- current
    3. I placed idea.desktop file in /opt/idea
    4. As Icon I set /opt/idea/current/bin/idea.png
    5. I created a softlink in /usr/local/share/applications: ln -s /opt/idea/idea.desktop /usr/local/share/applications/idea.desktop
    6. I used the following call to update the favorites:
    gsettings get com.canonical.Unity.Launcher favorites|\
    sed "s#\('unity://running-apps'\)#'application://idea.desktop', \\1#"|\
    sed "s#\(.*\)#\"\\1\"#"|\
    xargs -t gsettings set com.canonical.Unity.Launcher favorites

    An additional note: Your desktop file requires Idea to be in the executable path. I created a softlink in /usr/local/bin to achieve this:

    ln -s /opt/idea/current/bin/idea.sh /usr/local/bin/idea

    Having the current softlink it is easy to install a new Idea version and just have to adjust one single softlink.

    ReplyDelete
  2. After launching IntelliJ from the terminal it will appear in the launcher where you can select "Keep in launcher" after right-clicking the icon.
    (I previously tried "Configuration" -> "Create Shortcut" in the dialog after launching IntelliJ, which did not work as expected.)

    ReplyDelete