[Wine] Re: How to create a Wine shortcut on the Desktop (KDE)

landeel wineforum-user at winehq.org
Sun Feb 5 12:42:17 CST 2012


I made those scripts:

wine-extracticon

Code:
#!/bin/bash
# wine-extracticon

echo Usage : wine-extracticon myapp.exe

MYFILE=$(readlink -f "$1")
shift
for i in $@; do MYFILE="$MYFILE $i"; done
MYBASENAME=$(basename "$( readlink -f "$MYFILE")")

echo "Extracting icon(s)..."
wrestool -x -t 14 "$MYFILE" > "/tmp/$MYBASENAME.ico"

echo Converting icon to PNG...
convert -alpha on "/tmp/$MYBASENAME.ico" "/tmp/$MYBASENAME.png"

#try to copy if there's only 1 icon
cp "/tmp/$MYBASENAME.png" "$MYFILE.icon.png"

#  the script will assume the best icon is the bigger one
echo Copy "$(ls -S -1 "/tmp/$MYBASENAME"*".png" | tac | tail -n 1)" to "$MYFILE.icon.png" ...
cp "$(ls -S -1 "/tmp/$MYBASENAME"*".png" | tac | tail -n 1)" "$MYFILE.icon.png"

echo "Done."





wine-createshortcut

Code:

#!/bin/bash
# wine-createshortcut
# by Cleber de Mattos Casali   http://cmcgames.blogspot.com
#
# This script will create a .desktop shortcut for wine applications.

echo
echo wine-createshortcut
echo
echo by Cleber de Mattos Casali   http://cmcgames.blogspot.com

if [ $@ ]; then echo

echo Extract icon...
wine-extracticon "$@"

MYFILE=$(readlink -f "$1")
shift
for i in $@; do MYFILE="$MYFILE $i"; done
MYBASENAME=$(basename "$( readlink -f "$MYFILE")")
MYPATH=$(dirname "$( readlink -f "$MYFILE")")

CATEGORY=$(zenity --title "wine-createshortcut" --height=450 --list --radiolist --column " " --column "Categories" 0 AudioVideo 0 Audio 0 Video 0 Development 0 Education TRUE Game 0 Graphics 0 Network 0 Office 0 Settings 0 System 0 Utility  --text "Select a Category:")

APPNAME=$(zenity --title "wine-createshortcut" --text "Enter a name for your shortcut" --entry)

echo Create shortcut contents...
myshortcut="[Desktop Entry]"\\n"Exec=wine start /Unix \""$MYFILE"\""\\n"Name=$APPNAME"\\n"Path=$MYPATH"\\n"Type=Application"\\n"Categories=Application;$CATEGORY;"\\n"Icon="$MYFILE.icon.png""

echo Create .desktop file...
echo -e $myshortcut >"$MYFILE".desktop

echo Create links on desktop and applications menu...
ln -s "$MYFILE.desktop" "$HOME/Desktop/$MYBASENAME.desktop"
ln -s "$MYFILE.desktop" "$HOME/.local/share/applications/$MYBASENAME.desktop"

echo Done.

else echo; echo Usage : wine-createshortcut myapp.exe ; echo

fi










More information about the wine-users mailing list