The first script will extract icons from the .EXE file, choose the best icon, convert it to PNG, and copy it to the same folder of the application.
The second one depends on the first. It and can be very useful. If you simply call "wine-createshortcut MYAPP.EXE" it will produce a shortcut for the application, in desktop and applications menu, with the proper icon.

wine-extracticon
Code: Select all
#!/bin/bash
# wine-extracticon
echo "Extracting icon(s)..."
wrestool -x -t 14 "$( readlink -f "$@")" > "/tmp/$( basename "$( readlink -f "$@")").ico"
echo Converting icon to PNG...
convert -alpha on "/tmp/$( basename "$( readlink -f "$@")").ico" "/tmp/$( basename "$( readlink -f "$@")").png"
# the script will assume the best icon is the bigger one
echo Copy $(ls -S -1 "/tmp/$( basename $( readlink -f "$@"))"*".png" | tac | tail -n 1) to "$( readlink -f "$@").icon.png" ...
cp $(ls -S -1 "/tmp/$( basename $( readlink -f "$@"))"*".png" | tac | tail -n 1) "$( readlink -f "$@").icon.png"
echo "Done."
Code: Select all
#!/bin/bash
# wine-createshortcut
echo Extract icon...
wine-extracticon "$@"
echo Create shortcut contents...
myshortcut="[Desktop Entry]"\\n"Exec=wine start /Unix \""$( readlink -f "$@")"\""\\n"Type=Application"\\n"Categories=Application"\\n"Icon="$( readlink -f "$@")".icon.png"
echo Create .desktop file...
echo -e $myshortcut >"$( readlink -f "$@")".desktop
echo Create links on desktop and applications menu...
ln -s "$( readlink -f "$@").desktop" "$HOME/Desktop/$( basename "$( readlink -f "$@")").desktop"
ln -s "$( readlink -f "$@").desktop" "$HOME/.local/share/applications/$( basename "$( readlink -f "$@")").desktop"
echo Done.
Any bash script experts? I need help!