10

This has been asked before but the answer provided isn't valid anymore.

H3R3T1K
  • 2,401
  • 1
    can you clarify what(or when) you mean by "the answer provided isn't valid anymore"? I am running 20.04 and mine(shortcut to .appimage) works both in the gnome and metacity launchers... And I just used the common basic launcher configuration... – WU-TANG Nov 07 '20 at 04:48

2 Answers2

3

There are a few parts to this.

The first, most basic issue is that, as far as Linux is concerned, an AppImage is just an executable binary program like any other. For this to work, the first thing you have to do is to make the AppImage file executable because that permission is generally disabled in most things that you download.

chmod 755 your-AppImage-file

The other part of this is telling your system where to find the AppImage file. When you run things from your GUI, don't assume that the environment is setup the same as when you run them from a terminal. In particular, KDE doesn't run .bashrc first, so any customizations it does like adding $HOME/bin to your PATH have not been done.

I store all my AppImage files in $HOME/Containers which is not in my PATH, so Linux can't find them by default. So, I could either add that directory to my PATH or specify it when I run the AppImage. I choose the latter.

Once this issue is taken care of, all you have to do is add an entry in your launcher to run the AppImage. It should be set to run the absolute path to your AppImage file.

The second issue is that a bunch of the AppImages I use include their version number in their file names. When these get updated (sometimes automatically, by themselves), this breaks the menu entry that points to the old name. Rather than manually editing my menu every time this happens, I wrote a helper script to deal with this by finding the AppImage for me.

This should be saved in a file in a directory in your PATH such as $HOME/bin and set as executable.

#!/bin/bash
## app_launch 
## Launch an AppImage with a variable name
## Copyleft 06/10/2019 - Joseph J Pollock - JPmicrosystems
## Usage: app_launch <unique-name-substring>
## FIXME: arg may not have embedded blanks

##source $HOME/bin/bash_trace cd "$HOME/Containers" ## Where all my AppImages live ##find . -iname *$1*.AppImage ## debug real_name="$(find . -iname *$1*.AppImage)" ##echo "real_name = [$real_name]"

count="$(echo "$real_name" | wc -l)" if (( count > 1 )) then echo "Found more than one possible AppImage" exit 1 fi

if [[ ! -x "$real_name" ]] then echo "Can't find an executable AppImage for [$1]" exit 1 fi

./"$real_name"

I use this in the menu entry:

app_launch electrum %U

The trick here is to select a string ("electrum" in the above example) that is unique to the desired appImage file name, but doesn't change from release to release.

The %U isn't strictly necessary, but see the note below.

When you first configure a menu entry for a new AppImage, you should run app_launch from a terminal the first time because, if something goes wrong, it issues messages to the console and I didn't bother to make them GUI messages, so you won't see them when running the script from your menu/launcher.


When you add a menu entry, there are some optional parameters you can tack on as arguments. You normally don't need them, but they come in handy for more advanced usages. These work in KDE, but I suspect they are part of a more general standard and should work elsewhere as well.

%f - a single file name
%F - a list of files; use for applications that can open several local files at once
%u - a single URL
%U - a list of URLs
%d - the folder of a file to open
%D - a list of folders
%i - the icon
%m - the mini icon
%c - the caption

I have some bash scripts that take a file name as an argument. I have them in my menu and I also have them set as file type options in my file manager which are offered when I right click on a file icon in my file manager. When I do that, the file manager replaces %f with the name of the file I just clicked on so my script knows to work with that file.

Joe
  • 1,884
3

I found a quick way of doing this, following the advice on this article: linuxconfig.org

In short, once you have your .AppImage file (and have made it executable if it's not already so) and the logo of the app (can be png, svg, etc), you create a file with a name ending in .desktop, eg: fancy_app.desktop with content like the following:

[Desktop Entry]
Name=Fancy App
Comment=Does this and that
Exec=/home/username/path/to/the/fancy_app.appimage
Icon=/home/username/path/to/the/app-logo.png
Terminal=false
Type=Application
Categories=Something;
Keywords=something;more;

And that's it! An icon will appear in your Applications menu and it will be searchable and runnable and able to be added in the Launcher.

Some conventions I found handy:

  • you can save the .desktop files in /home/username/.local/share/applications
  • you can save the app logos in /home/username/.local/share/icons/hicolor/32x32/apps

I hope that helps!

gkri
  • 131
  • 1
    the app logos directory didn't work for me, I ended up just putting the app logo in the same directory as the .appimage and pointing to it from the .desktop file – HungryPipo May 08 '23 at 21:12