prateekmedia / appimagepool

A simple, modern AppImageHub Client, powered by flutter.

Home Page:https://www.pling.com/p/1547076/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Appimage's internal `.desktop` and icon files to better integrate with a Freedesktop

magnus-ISU opened this issue · comments

AppImages are required to have both an icon and a desktop file bundled with them, but this is mostly unused to my knowledge because it is annoying for users to extract them themselves.

It would be cool if appimagepool would automatically put them into .local/share/applications and .local/share/pixmaps respectively, so that right after installing an app you could launch it from any app launcher rather than just appimagepool.

I know, But I don't know how it will be achieved.

You can run any appimage with --appimage-extract to create a directory called squashfs-root, then extract the necessary files from there. You can extract files matching a pattern, but it seems to not be any regex as *.desktop matches the desktop file, but I can't figure out how to make it extract *.svg or *.png in the same run. Unfortunately, there appears to be no documentation on this feature, so you would have to either look at the source code of appimagetool to find out or just run --appimage-extract several times (which may not be nice for CPU) or run --appimage-extract once without arguments, which may use more memory/disk space than is necessary. Though probably it doesn't matter at all.

Either should work though, and then move the files to the right places from there.

It could be nice if you copied the appimage to /tmp before you ran --appimage-extract to avoid making pointless disk writes.

I tested a bit more and it seems that if myprogram.svg is a symlink (as is the case for appimagepool) then doing a simple pattern search won't work, so a full --appimage-extract is probably necessary every time.

Also, you don't have to copy the file to /tmp you just have to cd there. And it might be better to use $XDG_RUNTIME_DIR for that.

Anyway, hope this gives you some ideas. I don't actually use appimages really so its not worth it for me to go and actually make a PR, but I do think improving the linux ecosystem is a worthwhile goal which is why I decided to check out this software and make the issue. Good luck

commented

I wrote a shell script (although abit messy) that grabs the .desktop of an appimage, following what @magnus-ISU said.
However, the part where it changes the Exec= part, i just wrote a rust program for it and output to $HOME/.local/share/applications
Icons can be grabbed the same way, but i haven't tried to.

Hi, @magnus-ISU and @Git-Fal7 Thank you both for your suggestions, in the recent two commit I have tried to implement the desktop integration logic in this app, If you want you can test the nightly appimage from https://github.com/prateekmedia/appimagepool/releases/continuous/.

Also @Git-Fal7 I noticed you don't need rust to replace the lines; you can use sed command to do the same:

sed 's:Exec=$execPath:Exec=${i.path}:g' -i desktop_file.desktop

Fixed in v5!