Created
April 5, 2026 05:35
-
-
Save BreadFish64/fb50f1161b6dc14df8414a1161860a08 to your computer and use it in GitHub Desktop.
Extract icon from .exe to the user's icon directory. Useful for setting wine application shortcut icons with correct mip levels in Plasma.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function png_to_icon_root -a png_path exe_name | |
| set icon_root ~/.local/share/icons/hicolor | |
| set dimensions (magick identify -ping -format '%wx%h' $png_path) | |
| set destination "$icon_root/$dimensions/apps/$exe_name.png" | |
| mv --verbose $png_path $destination | |
| end | |
| function extract_exe_icon -a exe_path | |
| set exe_name (path basename $exe_path) | |
| set extract_dir (mktemp --directory) | |
| wrestool --verbose --extract --type=14 --output="$extract_dir/icon.ico" $exe_path | |
| magick -verbose "$extract_dir/icon.ico" -alpha on "$extract_dir/icon.png" | |
| for png in $extract_dir/*.png | |
| png_to_icon_root $png $exe_name & | |
| end | |
| wait | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment