Create Desktop Application Menu on Ubuntu
Created at 2016-09-30T20:10:27.000Z

Linux version of Android Studio is not distributed as a package (.deb file) and its installation instruction only says

To launch Android Studio, open a terminal, navigate to the android-studio/bin/ directory, and execute studio.sh.

So, I thought it's good occasion to create desktop application menu by myself for the first time.

I didn't know any mechanism about desktop application registration, but it wasn't hard even without googling. Here is my process:

  • Guessed other application must have some config file for this mechanism
    • Ran dpkg-query -L emacs24 and found /usr/share/applications/emacs24.desktop
  • Searched for local man page include "desktop"
  • Wrote androind-studio.desktop as below: (I downloaded and extracted zip at /home/hiogawa/repositories/downloads/path/)
[Desktop Entry]
Name=Android Studio
GenericName=IDE for Android Application Development
Exec=/home/hiogawa/repositories/downloads/path/android-studio/bin/studio.sh
Icon=/home/hiogawa/repositories/downloads/path/android-studio/bin/studio.png
Type=Application
  • Ran sudo xdg-desktop-menu install android-studio.desktop but it didn't work.
  • Ran sudo desktop-file-install android-studio.desktop and it did work.

Screenshot from 2016-10-01 14-08-40

Small talks

$ dpkg-query -S desktop-file-install
desktop-file-utils: /usr/share/man/man1/desktop-file-install.1.gz
desktop-file-utils: /usr/bin/desktop-file-install

$ dpkg-query -S xdg-desktop-menu 
xdg-utils: /usr/bin/xdg-desktop-menu
xdg-utils: /usr/share/man/man1/xdg-desktop-menu.1.gz