Adding Appimages to Xubuntu menu, Ubuntu applications and run them on Sudo by default

Create yourself a `.desktop` file

A.desktop file in Linux are desktop entries. These configuration files that describe how an application is launched and which data it can handle. They also configure how an application appears in a menu with an icon, which is subject to the related menu specification standard. Read more about it in the ArchWiki. Create a <appimage-name>.desktop file with the configuration template below by replacing information as you see fit. There is an actual example + more step steps below it.

[Desktop Entry]

# The type as listed above
Type=Application

# The version of the desktop entry specification to which this file complies
Version=1.0

# The name of the application
Name=jMemorize

# A comment which can/will be used as a tooltip
Comment=Flash card based learning tool

# The path to the folder in which the executable is run
Path=/opt/jmemorise

# The executable of the application, possibly with arguments.
Exec=jmemorize

# The name of the icon that will be used to display this entry
Icon=jmemorize

# Describes whether this application needs to be run in a terminal or not
Terminal=false

# Describes the categories in which this entry should be shown
Categories=Education;Languages;Java;

Putting .desktop files in the right place

Place this file in the /usr/share/applications directory so that it is accessible by everyone, or in ~/.local/share/applications if you only wish to make it accessible to a single user. Which is used should depend on whether your application is installed systemwide or into a user’s home directory. GNOME monitors these directories for changes, so simply copying the file to the right location is enough to register it with the desktop. I use albert for applications and here’s how it looks.

The first is Etcher appimage and other is the etcher Debian package.


Adding Etcher to the menu,

Here’s my etcher.desktop placed in /usr/share/applications directory. The Icon field is the path to the etcher icon that you want to see in the menu. You can go ahead and use any image for that.

[Desktop Entry]
Name=Etcher
Comment=Flash OS images to SD cards & USB drives
Keywords=etcher;flash;operating;drives;
Exec=sudo -A /home/vipulgupta2048/Downloads/balenaEtcher-1.5.106-x64.AppImage
StartupNotify=true
Terminal=false
Type=Application
Icon=/home/vipulgupta2048/Downloads/icon.png
Categories=GNOME;GTK;Office;Viewer;Graphics;2DGraphics;VectorGraphics;
MimeType=application/etcher;

Here’s how it looks finally. Notice, that sudo -A we have snuck in the Exec. Using sudo askpass, we will get a dialog box to always put etcher into sudo. Read more about configuring askpass.

Leave a Reply

Your email address will not be published. Required fields are marked *