# Accessing AppImage .desktop file

**URL:** <https://discourse.appimage.org/t/accessing-appimage-desktop-file/173>\
**Category:** Using AppImages\
**Created:** [April 5, 2017, 11:02pm UTC](https://discourse.appimage.org/t/accessing-appimage-desktop-file/173 "2017-04-05T23:02:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CalebQ42](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/calebq42/32/151_2.png) [@CalebQ42](https://discourse.appimage.org/u/CalebQ42)\
**Post date:** [April 5, 2017, 11:02pm UTC](https://discourse.appimage.org/t/accessing-appimage-desktop-file/173/1 "2017-04-05T23:02:39Z")

</div>

I’ve created a [portableapps.com](http://portableapps.com) type launcher (found [here](http://github.com/CalebQ42/LinuxPA)). 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?

---

<div class="post-metadata">

**Author:** ![Royi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/royi/32/150_2.png) [@Royi](https://discourse.appimage.org/u/Royi)\
**Post date:** [May 28, 2018, 5:36am UTC](https://discourse.appimage.org/t/accessing-appimage-desktop-file/173/2 "2018-05-28T05:36:43Z")

</div>

This is a great idea.

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

---

<div class="post-metadata">

**Author:** ![Royi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/royi/32/150_2.png) [@Royi](https://discourse.appimage.org/u/Royi)\
**Post date:** [May 28, 2018, 9:02pm UTC](https://discourse.appimage.org/t/accessing-appimage-desktop-file/173/3 "2018-05-28T21:02:02Z")

</div>

By the way,

Could you integrate automatically the `.home` and `.config` features of AppImage?  
Also could you integrate using Sand Boxing (Using [FireJail](https://github.com/netblue30/firejail) like [`appimaged`](https://github.com/AppImage/appimaged))?

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [May 30, 2018, 5:35am UTC](https://discourse.appimage.org/t/accessing-appimage-desktop-file/173/4 "2018-05-30T05:35:08Z")

</div>

> [@CalebQ42](#):
>
> 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?

Using `libappimage`, you would so something like this:

```auto
    /* 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.

---

<div class="post-metadata">

**Author:** ![CalebQ42](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/calebq42/32/151_2.png) [@CalebQ42](https://discourse.appimage.org/u/CalebQ42)\
**Post date:** [June 4, 2018, 9:50pm UTC](https://discourse.appimage.org/t/accessing-appimage-desktop-file/173/5 "2018-06-04T21:50:17Z")

</div>

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