3 # Create menu/desktop entries for an application
4 # This is used by the IShellLink interface
6 # Copyright 2000 Alexandre Julliard
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 usage: wineshelllink options
38 --desktop create a desktop link
39 --menu create a menu entry
40 --path xx path to the application
41 --link xx name of link to create
42 --args xx command-line arguments for the application
43 --icon xx icon to display
44 --workdir xx working directory for the application
45 --descr xx application description
51 if [ $# -eq 0 ] ; then
58 --desktop) mode
="desktop"; shift 1 ;;
59 --menu) mode
="menu"; shift 1 ;;
60 --path) path
="$2"; shift 2 ;;
61 --link) link
="$2"; shift 2 ;;
62 --args) args
="$2"; shift 2 ;;
63 --icon) icon
="$2"; shift 2 ;;
64 --descr) descr
="$2"; shift 2 ;;
65 --workdir) workdir
="$2"; shift 2 ;;
70 if [ "$mode" = "" ] ; then
71 echo Either
--desktop or
--menu required
75 if [ "$link" = "" ] ; then
76 echo You must specify a link name with
--link
82 xname
=`basename "$link"`
87 Exec=wine "$path" -- $args
91 [ -z "$workdir" ] ||
echo "Path=\"$workdir\""
92 [ -z "$xpmicon" ] ||
echo "Icon=$xpmicon"
97 xname
=`basename "$link"`
101 Exec=wine "$path" -- $args
105 [ -z "$workdir" ] ||
echo "Path=\"$workdir\""
106 [ -z "$xpmicon" ] ||
echo "Icon=$xpmicon"
111 base
=`basename "$link"`
112 section
=`dirname "$link"`
113 [ -z "$icon" ] || xicon
="icon=\"$xpmicon\""
114 echo "?package(local.Wine):needs=x11 section=\"Wine/$section\" title=\"$base\" longtitle=\"$descr\" command=\"wine \\\"$path\\\" -- $args\" $xicon"
117 # copy the icon file to a specified dir and set xpmicon to the resulting path
122 mkdir
-p "$dir/""`dirname "$link"`" || true
125 cp "$icon" "$dir/$link.xpm"
126 xpmicon
="$dir/$link.xpm"
134 which update-menus
> /dev
/null
2>&1
135 if [ $?
= 0 -a $mode = "menu" ]
137 iconname
="`basename "$link"`.xpm"
138 dir
="$HOME/.menu/icons"
142 cp "$icon" "$dir/$iconname"
143 xpmicon
="$dir/$iconname"
147 mdk_entry
>> "$HOME/.menu/wine"
148 update-menus
> /dev
/null
2>&1
153 if [ -d "$HOME/.kde" ]
155 copy_icon
"$HOME/.kde/share/applnk/Wine"
156 if [ $mode = "menu" ]
158 kde_entry
> "$HOME/.kde/share/applnk/Wine/$link.kdelnk"
160 # KDE 1.x kludge. Wake up KDE, if we can find kpanel running
161 which kwmcom
>/dev
/null
2>/dev
/null
&& \
162 ps u
-C kpanel
>/dev
/null
2>/dev
/null
&& \
163 kwmcom kpanel
:restart
165 elif [ -d "$HOME/Desktop" ]
167 kde_entry
> "$HOME/Desktop/$link.kdelnk"
168 # KDE 1.x kludge: wake up KDE, if we can find kfm running...
169 which kfmclient
>/dev
/null
2>/dev
/null
&& \
170 ps u
-C kfm
>/dev
/null
2>/dev
/null
&& \
171 kfmclient refreshDesktop
175 if [ -d "$HOME/.kde2" ]
177 copy_icon
"$HOME/.kde2/share/applnk/Wine"
178 if [ $mode = "menu" ]
180 gnome_entry
> "$HOME/.kde2/share/applnk/Wine/$link.desktop"
181 elif [ -d "$HOME/Desktop2" ]
183 gnome_entry
> "$HOME/Desktop2/$link.desktop"
192 if [ -d "$HOME/.gnome" ]
194 copy_icon
"$HOME/.gnome/apps/Wine"
195 if [ $mode = "menu" ]
197 gnome_entry
> "$HOME/.gnome/apps/Wine/$link.desktop"
198 elif [ -d "$HOME/.gnome-desktop" ]
200 gnome_entry
> "$HOME/.gnome-desktop/$link.desktop"