Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully Conform to the AppImage format by including .desktop & icons #18

Open
Azathothas opened this issue Sep 8, 2024 · 0 comments
Open

Comments

@Azathothas
Copy link

Azathothas commented Sep 8, 2024

Hi, we have started to use nix-appimage to create portable AppImages over at: https://github.com/Azathothas/Toolpacks
Unfortunately, currently we have to extract the AppImage (created by nix-appimage ) and then use some bash kung-fu to place the relevant .desktop & icon files.
For an example to create an mpv AppImage: https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/x86_64_Linux/bins/mpv.sh

#Media
cd "${APPIMAGE_EXTRACT}"
mkdir -p "./usr/share/applications" && mkdir -p "./usr/share/metainfo"
SHARE_DIR="$(find "." -path '*share/*mpv*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | awk -F'/share/' '{print $1}')/share" && export SHARE_DIR="${SHARE_DIR}"

#usr/{applications,bash-completion,icons,metainfo,mpv,zsh}
 rsync -av --copy-links \
                      --include="*/" \
                      --include="*.desktop" \
                      --include="*.png" \
                      --include="*.svg" \
                      --include="*.xml" \
                      --exclude="*" \
                     "${SHARE_DIR}/" "./usr/share/" && ls "./usr/share/"
                     
#Icon
find "." -path '*128x128/apps/*.png' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp "{}" ./mpv.png'
find "." -maxdepth 1 -type f -name '*.svg' -exec sh -c 'convert "$0" "${0%.svg}.png"' {} \; 2>/dev/null
cp "./mpv.png" "./.DirIcon"

##Desktop
find "." -path '*mpv*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./mpv.desktop"'
sed 's/Icon=[^ ]*/Icon=mpv/' -i "./mpv.desktop" 2>/dev/null

As per the readme:

Additionally, the produced file isn't a fully conforming AppImage. For example, it's missing the relevant .desktop file and icons -- this doesn't affect the running of bundled apps in any way, but might cause issues with showing up correctly in application launchers (e.g. rofi). Please open an issue if this is something you want.

It would be nice to have nix-appimage include the .desktop & icons too.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant