Accessing AppImage .desktop file

I’ve created a portableapps.com type launcher (found here). I would like to integrate AppImages some more, but I can’t seem to actually access the AppImages internal files, such as the .desktop and icon files. Any suggestions?

1 Like

This is a great idea.

We need the AppImages to be easily integrated into the user desktop.

By the way,

Could you integrate automatically the .home and .config features of AppImage?
Also could you integrate using Sand Boxing (Using FireJail like appimaged)?

Using libappimage, you would so something like this:

    /* Extract the desktop file from the AppImage */
    char** files = appimage_list_files(g_file_get_path(file));
    g_autofree gchar *desktop_file = NULL;
    gchar *extracted_desktop_file = "/tmp/your.desktop";
    int i = 0;
    for (; files[i] != NULL ; i++) {
        // g_debug("AppImage file: %s", files[i]);
        if (g_str_has_suffix (files[i],".desktop")) {
            desktop_file = files[i];
            g_debug("AppImage desktop file: %s", desktop_file);
            break;
        }
    }
    /* Exit if we cannot find the desktop file */
    if(desktop_file == NULL) {
        g_debug("AppImage desktop file not found");
        appimage_string_list_free(files);
        return FALSE;
    }
    /* Extract desktop file to temporary location */
    appimage_extract_file_following_symlinks(g_file_get_path(file), desktop_file,
                                             extracted_desktop_file);

    appimage_string_list_free(files);

Also study the source code of appimaged. Most of what you want to do will be implemented there in some shape of form.

Thanks! That’s a huge help, especially since I have yet to learn C or C++.