less than 1 minute read

如何解压AppImage

参考https://superuser.com/questions/1301583/how-can-i-extract-files-from-an-appimage

  • 判断AppImage format (type 1 或 type 2)

    ./xxx.AppImage --appimage-help. 如果有--appimage-extract选项, 说明是type 2,没有是type 1.

  • 方法1: type 2格式可以直接用–appimage-extract或–appimage-mount

    缺点是需要运行xxx.AppImage(不是直接运行content),如果不信任的话最好不运行

  • 方法2: 用官方tool https://github.com/AppImage/AppImageKit. (目前只支持解压type1的)

    用appimagetool-x86_64.AppImage –list xxx.AppImage查看, 用appimagetool-x86_64.AppImage xxx.AppImage somedir/解压

  • 方法3: 手动挂载(获取–appimage-offset也是需要运行)

    type1: mount -o loop my.AppImage mountpoint/; umount mountpoint/

    type2: xxx.AppImage –appimage-offset; mount xxx.AppImage mountpoint/ -o offset=???; umount mountpoint/

与desktop 集成

https://github.com/TheAssassin/AppImageLauncher

这个工具会后台运行daemon。

可以用./xxx.AppImage --appimage-extract获得图标和desktopentry,然后手动集成

  1. cp squashfs-root/xx.desktop ~/.local/share/applications
  2. cp -r squashfs-root/usr/share/icons/hicolor/* ~/.local/share/icons/hicolor/
  3. (optional)svg文件可以安装inkscape后手动生成icon (https://gist.github.com/dw72/24dc5891b35b3a7ed53737272ed10b2d)
    > for size in 16 22 24 32 48 64 128 256 512 1024
    for> do
    for> inkscape -o ~/.local/share/icons/hicolor/${size}x${size}/apps/{.desktop文件中设置的名字}.png -w $size -h $size  /path/to/icon.svg
    for> done
    > xdg-icon-resource forceupdate
    
  4. (optional)xdg-desktop-menu forceupdate xdg-icon-resource forceupdate

参考:

  • https://specifications.freedesktop.org/basedir-spec/latest/
  • https://specifications.freedesktop.org/menu-spec/latest
  • https://specifications.freedesktop.org/desktop-entry-spec/latest/recognized-keys.html
  • https://specifications.freedesktop.org/icon-theme-spec/latest/

desktop entry

Execfield codes expansion只会执行一次。所以jmeter要支持直接打开和双击.jmx文件打开,可以如下设置:

Exec=zsh -ic "file=%f;if test -n $file;then /home/sify/Applications/apache-jmeter-5.6.3/bin/jmeter -t \"$file\"; else /home/sify/Applications/apache-jmeter-5.6.3/bin/jmeter; fi"

zsh -ic是为了加载asdf环境,其中~/.asdf/plugins/java/set-java-home.zsh里的asdf_update_java_home手动调用了一次,因为add-zsh-hook precmd在zsh -ic时不会执行?

Categories:

Updated: