Skip to content

Instantly share code, notes, and snippets.

@micmalti
Created July 7, 2025 11:29
Show Gist options
  • Save micmalti/26218fc0090f4d6ec2348dca62c61fe1 to your computer and use it in GitHub Desktop.
Save micmalti/26218fc0090f4d6ec2348dca62c61fe1 to your computer and use it in GitHub Desktop.
#!/bin/bash
## Author: Michael Gauci
## Description: Update the icon files of the Joplin AppImage. Tested on 2.14.23.
## License: MIT
## Version: 1.0
shopt -s globstar nullglob
DESKTOP_ICON=$1
PANEL_ICON=$2
APPIMAGE_NAME=$3
chmod -R 755 "./$APPIMAGE_NAME"
"./$APPIMAGE_NAME" --appimage-extract
icon_sizes=(
['16']='16x16'
['24']='24x24'
['32']='32x32'
['48']='48x48'
['72']='72x72'
['96']='96x96'
['128']='128x128'
['144']='144x144'
['256']='256x256'
['512']='512x512'
['1024']='1024x1024'
)
for icon_path in ./squashfs-root/**/*.png; do
unset size
for icon_size in "${!icon_sizes[@]}"; do
if [[ "$icon_path" == *"${icon_sizes[$icon_size]}"* ]]; then
if [[ "$icon_path" == *'@2'* ]]; then
size=$((icon_size * 2))
elif [[ "$icon_path" == *'@3'* ]]; then
size=$((icon_size * 3))
else
size="$icon_size"
fi
fi
done
if ! [ -v size ]; then
continue
fi
icon_source=$([[ "$icon_path" == *'16x16'* ]] && echo "$PANEL_ICON" || echo "$DESKTOP_ICON")
inkscape -w "$size" -h "$size" -o "$icon_path" --export-type=png "$icon_source"
done
cp ./squashfs-root/resources/build/icons/256x256.png ./squashfs-root/joplin.png
ARCH=x86_64 appimagetool -v squashfs-root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment