71

How can I register an .appimage file (specifically, the tiled map editor found here) as a desktop app? (Like Firefox -- I can launch it by typing 'Firefox' into search rather than opening up a console and typing /path/to/directory/firefox.ext)

Flimm
  • 43,943
  • Place the executable file in you PATH in say /usr/bin and you should be able to launch it like firefox... – George Udosen Apr 08 '17 at 23:51
  • Is there a way to put a 'shortcut' to the file in my PATH? I don't want to move it there. –  Apr 08 '17 at 23:53
  • Never mind, I just made a bash script that launches it and stuck that in ~/bin. Thanks for your help, even though you didn't actually answer the question :P –  Apr 08 '17 at 23:54

5 Answers5

59

Create a .desktop file that points to the application -- here is an example of a .desktop for minecraft:

[Desktop Entry]
Type=Application
Name=Minecraft
Comment=Minecraft
Icon=/home/bram/Applications/Minecraft/icon.png
Exec=/home/bram/Applications/Minecraft/minecraft
Terminal=false
Categories=Minecraft;game

Put that file in ~/.local/share/applications

Serge Stroobandt
  • 5,758
  • 1
  • 54
  • 59
  • Done what you said, It will keep open a terminal while I am executing the AppImage? Is there a way to just open the AppImage without a terminal together? – cassmtnr Dec 27 '18 at 17:35
  • 20
    Why would you need to download a separate icon when the appimage includes one? How can you use the icon from the appimage itself? – Dan Dascalescu Feb 03 '19 at 17:47
  • The AppImage I was trying to create a desktop launcher for and its icon were in /opt/app-dir/. I ran chmod 777 icon.png but the icon was not showing up. I had to put the image in /usr/share/pixmaps/ and put Icon=<icon-name-without-extension-or-path> in the launcher to make the icon visible. – Mike Sep 12 '20 at 10:35
  • @Mike (and perhaps others). Since 26 people upvoted and so presumably followed this answer can one of them replace the example with the Joplin one to save anyone coming after from having to replace Minecraft with Joplin. – Kvothe Jun 01 '21 at 15:24
  • I needed to read this answer: https://askubuntu.com/a/1240983/800252. In order to figure out how to make this work (For extracting the Icon and the correct .desktop entry which is non-trivial to guess, for example to get "StartupWMClass=Joplin" right.). – Kvothe Jun 02 '21 at 09:02
  • @DanDascalescu Not sure if it is the most correct way, but i was able to extract the icon this way from the terminal: ./Some-X.Y.Z.Appimage --appimage-extract, it extracted to a squashfs folder, wher i was able to find a PNG file for the icon. – jmunsch Jan 17 '23 at 17:54
48

You can also use AppImageLauncher which provides desktop integration along with some additional features. Unlike appimaged, it:

  • asks for confirmation before creating desktop entry for an AppImage.
  • works with AppImages in any location
  • doesn't use a daemon for monitoring, so more efficient.

Specifics of how it works are explained in the wiki. It can be installed directly from the packages provided in the releases using the command:

sudo dpkg -i <downloaded-package-name>.deb
aksh1618
  • 616
  • I just installed it on Ubuntu Focal through the PPA. I launched a Zoom AppImage and now it appears in the launcher if I type Zoom. Neat :) – Immanuel Weihnachten Dec 15 '20 at 17:46
  • 1
    Could you include a simple example of how it work. An (uncareful) read of the linked wiki does not make it clear at all. – Kvothe Jun 01 '21 at 15:28
  • @Kvothe I'm not the creator of this tool :) Consider creating an issue in the repository asking for the same. – aksh1618 Jul 20 '21 at 08:23
  • Worked on PopOS 21.04 GNOME as well. Great! – Reza Taba Aug 08 '21 at 19:59
  • It works great! All I had to do was (a) install as shown here, (b) run it on the terminal, i.e., "$ appimagelauncher", and (c) open the AppImage as usual. The first time you run an AppImage, appimagelauncher will catch it and "install it." That's it! – gvegayon Jan 20 '22 at 18:56
  • @gvegayon Are you sure step b is required, I don't recall having to do it. For me it was just install and double click appimage file. – aksh1618 Jan 21 '22 at 08:58
  • The fact that the non-deprecated, updated https://github.com/probonopd/go-appimage/blob/master/src/appimaged/README.md automatically monitors and links files in the ~/Downloads directory is a bit scary. – Dave X Oct 06 '23 at 00:37
  • Doesn't work for me. (Ubuntu 22.04 Jammy.) I installed without incident. Cannot find via cl "appimagelaucher". However, per github page, to use ail-cli. That command doesn't tell me what to do, -h option is to vague. On Application Launcher There is AppImageLaucher settings, but all that does is ask where my appimages are. Didn't put anything on my desktop. Didn't launch anything. :( – Joe Molnar Dec 03 '23 at 23:12
  • Unfortunately, AppImageLauncher does not work on Debian Bookworm. I've created this shell script which automagically creates a desktop file and also creates a symlink to the application under $HOME/bin: https://github.com/frgomes/bash-scripts/blob/master/bin/appimage-desktop-entry – Richard Gomes Nov 03 '24 at 02:16
  • 1
    As of 2024-12-14, apt install of this application does not work for Ubuntu 24.10. I downloaded and installed the .deb file successfully instead. I could not see a way to integrate the apps. As mentioned by @JoeMolnar, I found ail-cli in the docs and ran ail-cli integrate [appimage_filespecs], and then was able to access the appimages in the desktop menu. – Keith Bennett Dec 14 '24 at 11:51
27

According to appimagekit, the proper method is to use appimaged for .AppImage file registration.

For 64-bit systems:

wget "https://github.com/AppImage/appimaged/releases/download/continuous/appimaged-x86_64.AppImage"
chmod +x appimaged-x86_64.AppImage
./appimaged-x86_64.AppImage --install

The binary will copy itself to /home/ubuntu/.local/bin/appimaged and then delete the downloaded copy upon install. Then you must logout and back in.

At time of reading, it will monitor and register the following locations:

~/Downloads
~/.local/bin
~/bin
/Applications
/isodevice/Applications
/isofrom/Applications
/run/archiso/img_dev/Applications
/opt
/usr/local/bin

To show in the menu, this assumes you've placed a desktop file in the correct location inside your .AppImage file, usually /usr/share/applications/<myproject>.desktop.

If you search in the application tray, you should find your application shortly. The daemon should also register any application-specific file associations assuming the mime xml is also bundled, usually /usr/share/mime/packages/<myproject>.xml. If the icon does not appear correctly, you may have to logout and back in a second time. This can happen if the icon was incorrectly cached while testing out images.

David Foerster
  • 36,900
  • 56
  • 98
  • 152
tresf
  • 1,082
  • The advice at appimaged link says to enable with sudo systemctl --user [...], but shouldn't it be --system [ie default], won't --user mean that it only enables for my user. I'm trying to install digikam for all users, FWIW. – pbhj Dec 19 '17 at 23:58
  • On my system, Ubuntu 14.04, the systemctl steps did not work properly. You should ask the project team how best to do this. The service seems like it's intended to be run in user-space by design, so the system-wide installation technique does not seem to be obvious. Perhaps you would be happy with the appimage located permanently somewhere (e.g. /opt/bin/appimaged with a login script for all users in /etc/xdg/autostart/appimaged.desktop, but one which uses the --no-install switch. – tresf Dec 26 '17 at 17:26
  • Then place digicam in (e.g.) /opt/bin/digicam and the daemon should find it as it will match the second-to-last search location mentioned above. – tresf Dec 26 '17 at 17:28
  • 2
    Appimaged from the https://github.com/AppImage/AppImageKit#appimage-usage points to https://github.com/AppImageCommunity/appimaged which is deprecated and points to https://github.com/probonopd/go-appimage/blob/master/src/appimaged/README.md which points to https://github.com/probonopd/go-appimage/blob/master/src/appimaged/README.md which works for me in 2023. If you install the appimage per those instructions, then it monitors $PATH, ~/Applications ~/.local/bin, /opt /usr/local/bin ~/Downloads (!!!) and configures your menus to link to the appimages. Win! – Dave X Oct 06 '23 at 00:33
  • 2
    @DaveX thanks for the reference. What's odd is both go-appimage and go-appimaged are listed as "experimental". I'll reach out to probonopd to see what he recommends and update the answer accordingly. – tresf Oct 09 '23 at 16:04
  • 1
    Unfortunately, appimaged does not install properly under Debian Bookworm. I've created a shell script which automagically creates a desktop file and slso creates a symlink to the application under $HOME/bin: https://github.com/frgomes/bash-scripts/blob/master/bin/appimage-desktop-entry – Richard Gomes Nov 03 '24 at 02:17
1
#!/bin/bash

# Script to create a .desktop file for an application using Zenity GUI

# Check if Zenity is installed
if ! command -v zenity &> /dev/null; then
    echo "Zenity is not installed. Please install it to run this GUI script."
    echo "On Debian/Ubuntu: sudo apt install zenity"
    echo "On Fedora: sudo dnf install zenity"
    echo "On Arch: sudo pacman -S zenity"
    exit 1
fi
# Get Application Details via Zenity

APP_NAME=$(zenity --entry \
    --title="Application Name" \
    --text="Enter the Application Name (e.g., MyCustomApp):" \
    --width=400 \
    --height=100)

if [ -z "$APP_NAME" ]; then
    zenity --error --title="Error" --text="Application Name cannot be empty. Exiting."
    exit 1
fi

EXEC_PATH=$(zenity --file-selection \
    --title="Select Application Executable" \
    --file-filter="Executables | *.sh *.py *.pl *.AppImage *.*" \
    --confirm-overwrite) # Allow selecting any file type

if [ -z "$EXEC_PATH" ]; then
    zenity --error --title="Error" --text="Executable path cannot be empty. Exiting."
    exit 1
fi

APP_COMMENT=$(zenity --entry \
    --title="Application Description" \
    --text="Enter a short description for the application:")

ICON_PATH=$(zenity --file-selection \
    --title="Select Application Icon" \
    --file-filter="Images | *.png *.svg *.xpm *.jpg *.jpeg *.gif" \
    --file-filter="All Files | *.*")

# Optional: Suggest common icon directories
if [ -z "$ICON_PATH" ]; then
    zenity --question \
        --title="Icon Path" \
        --text="No icon selected. Do you want to try a standard icon name (e.g., 'firefox') instead of a file path?"
    if [ $? -eq 0 ]; then
        ICON_PATH=$(zenity --entry \
            --title="Icon Name" \
            --text="Enter a standard icon name (e.g., firefox, gimp):")
        if [ -z "$ICON_PATH" ]; then
            zenity --warning --title="Warning" --text="No icon specified. The application may appear without an icon."
            ICON_PATH="" # Ensure it's empty if user backs out
        fi
    else
        zenity --warning --title="Warning" --text="No icon specified. The application may appear without an icon."
        ICON_PATH="" # Ensure it's empty if user backs out
    fi
fi

CATEGORIES=$(zenity --entry \
    --title="Application Categories" \
    --text="Enter Categories (comma-separated, e.g., Utility;Development;Game;)\n(See https://specifications.freedesktop.org/menu-spec/latest/apa.html for a list of categories):")

# Determine Terminal Requirement 
RUN_IN_TERMINAL=$(zenity --question \
    --title="Terminal Requirement" \
    --text="Does this application need to run in a terminal?")

TERMINAL_SETTING="false"
if [ $? -eq 0 ]; then # Zenity returns 0 for OK/Yes, 1 for Cancel/No
    TERMINAL_SETTING="true"
fi

# Creates the .desktop File Content 

DESKTOP_FILE_CONTENT="[Desktop Entry]
Name=${APP_NAME}
Comment=${APP_COMMENT}
Exec=${EXEC_PATH}
Icon=${ICON_PATH}
Terminal=${TERMINAL_SETTING}
Type=Application
Categories=${CATEGORIES}
"

# Choose Installation Location

INSTALL_LOCATION_CHOICE=$(zenity --list \
    --title="Installation Location" \
    --text="Where do you want to install the .desktop file?" \
    --radiolist \
    --column="Choice" --column="Location" \
    TRUE "For current user only (~/.local/share/applications/)" \
    FALSE "For all users (requires root privileges - /usr/share/applications/)")

DESKTOP_DIR=""
if [ "$INSTALL_LOCATION_CHOICE" == "For current user only (~/.local/share/applications/)" ]; then
    DESKTOP_DIR="$HOME/.local/share/applications"
elif [ "$INSTALL_LOCATION_CHOICE" == "For all users (requires root privileges - /usr/share/applications/)" ]; then
    DESKTOP_DIR="/usr/share/applications"
else
    zenity --error --title="Error" --text="Invalid choice for installation location. Exiting."
    exit 1
fi

# Creates a directory if it doesn't exist
mkdir -p "$DESKTOP_DIR"

DESKTOP_FILE_PATH="${DESKTOP_DIR}/${APP_NAME}.desktop"

# Deprecated for pkexec can still use sudo tee if you want
#if [ "$INSTALL_LOCATION_CHOICE" == "For all users (requires root privileges - /usr/share/applications/)" ]; then
   # echo "$DESKTOP_FILE_CONTENT" | sudo tee "$DESKTOP_FILE_PATH" > /dev/null
    #if [ $? -ne 0 ]; then
        #zenity --error --title="Error" --text="Failed to write desktop file to system-wide location. You may need to enter your password for 'sudo'."
        #exit 1
    #fi
    #sudo chmod +x "$DESKTOP_FILE_PATH"
#else
    #echo "$DESKTOP_FILE_CONTENT" > "$DESKTOP_FILE_PATH"
    #chmod +x "$DESKTOP_FILE_PATH"
#fi
if [ "$INSTALL_LOCATION_CHOICE" == "For all users (requires root privileges - /usr/share/applications/)" ]; then
    # Creates a temporary file to hold content
    TEMP_DESKTOP_FILE=$(mktemp)
    echo "$DESKTOP_FILE_CONTENT" > "$TEMP_DESKTOP_FILE"

    # Uses pkexec to copy and set permissions
    pkexec cp "$TEMP_DESKTOP_FILE" "$DESKTOP_FILE_PATH"
    if [ $? -ne 0 ]; then
        zenity --error --title="Error" --text="Failed to copy desktop file with root privileges. pkexec failed."
        rm "$TEMP_DESKTOP_FILE"
        exit 1
    fi
    pkexec chmod +x "$DESKTOP_FILE_PATH"

    rm "$TEMP_DESKTOP_FILE" # Clean up temp file
else
    echo "$DESKTOP_FILE_CONTENT" > "$DESKTOP_FILE_PATH"
    chmod +x "$DESKTOP_FILE_PATH"
fi

zenity --info --title="Success" --text="Desktop file created successfully!\nPath: ${DESKTOP_FILE_PATH}"

# Optional: Update Desktop Database (for some desktop environments) 
zenity --info --title="Updating Cache" --text="Attempting to update desktop icon cache (may require root for system-wide changes)..."

if command -v update-desktop-database &> /dev/null; then
    if [ "$INSTALL_LOCATION_CHOICE" == "For all users (requires root privileges - /usr/share/applications/)" ]; then
        sudo update-desktop-database "$DESKTOP_DIR"
    else
        update-desktop-database "$DESKTOP_DIR"
    fi
else
    zenity --warning --title="Warning" --text="update-desktop-database command not found. You may need to manually update or log out/in."
fi

zenity --info \
    --title="Completion" \
    --text="Your application '${APP_NAME}' should now appear in your application menu.\n\nIf it doesn't, try logging out and logging back in, or restarting your desktop environment."

exit 0 

To make the process 'less' tedious here is a code sample just basic interface but hey it works.. Just save it as an sh file and give it executable permission.

OR just download the file and set executable permission Appimage Integrator

0

I've found the app Pin It! by Ryo Nakano ( https://ryonakano.github.io/ ) a perfect solution

jmora
  • 1