Skip to content

Instantly share code, notes, and snippets.

@theapache64
Created March 19, 2021 15:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theapache64/18b9c281224f19abf506cfd82dff6253 to your computer and use it in GitHub Desktop.
Save theapache64/18b9c281224f19abf506cfd82dff6253 to your computer and use it in GitHub Desktop.
To generate launcher icons for compose desktop
function gen-cfd-icon(){
ICON_DIR="src/main/resources/drawables/launcher_icons"
mkdir -p $ICON_DIR
ORIGINAL_ICON="$ICON_DIR/original.png"
cp "$1" "$ORIGINAL_ICON"
# Linux
echo "🌀 Creating icon for Linux..."
convert -resize x128 "$ORIGINAL_ICON" "$ICON_DIR/linux.png"
# Windows
echo "🌀 Creating icon for Windows..."
convert -resize x128 "$ORIGINAL_ICON" "$ICON_DIR/windows.ico"
# MacOS
echo "🌀 Creating icon for macOS..."
convert -resize x128 "$ORIGINAL_ICON" "$ICON_DIR/macos.icns"
## Printing code
echo "Add this to your build.gradle.kts ⬇️"
OUTPUT="
val iconsRoot = project.file(\"src/main/resources/drawables\")
linux {
iconFile.set(iconsRoot.resolve(\"launcher_icons/linux.png\"))
}
windows {
iconFile.set(iconsRoot.resolve(\"launcher_icons/windows.ico\"))
}
macOS {
iconFile.set(iconsRoot.resolve(\"launcher_icons/macos.icns\"))
}"
echo "$OUTPUT"
echo "$OUTPUT" | xclip
echo "Copied to your clipboard"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment