How to create a Wine shortcut on the Desktop (KDE)

Questions about Wine on Linux
Locked
nounours18200
Level 1
Level 1
Posts: 8
Joined: Sat Dec 10, 2011 1:42 pm

How to create a Wine shortcut on the Desktop (KDE)

Post by nounours18200 »

Hi Friends,

I want to create a shortcut on the desktop (Fedora 16 with KDE 4) to call a windows executable (a ".exe", let say "discus.exe") . This programme does not need any install (so it does not appear on the K menu under the Wine section), it just has to be called via Wine.

How to proceed to create this shortcut ?
User avatar
dimesio
Moderator
Moderator
Posts: 13204
Joined: Tue Mar 25, 2008 10:30 pm

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

Post by dimesio »

nounours18200 wrote: How to proceed to create this shortcut ?
Add it to the KDE menu, then right click on the menu item to add it to your desktop.

If you don't know how to use the KDE menu editor, ask your distro. It's not a Wine question.
landeel
Level 2
Level 2
Posts: 34
Joined: Sun May 18, 2008 11:49 am

Post by landeel »

I made those scripts:

wine-extracticon

Code: Select all

#!/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: Select all

#!/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
Locked