2000-11-02 21:22:07 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Create menu/desktop entries for an application
|
|
|
|
# This is used by the IShellLink interface
|
|
|
|
#
|
|
|
|
# Copyright 2000 Alexandre Julliard
|
|
|
|
#
|
|
|
|
mode=""
|
|
|
|
args=""
|
|
|
|
menu=""
|
|
|
|
icon=""
|
|
|
|
descr=""
|
|
|
|
link=""
|
|
|
|
path=""
|
|
|
|
workdir=""
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
usage: wineshelllink options
|
|
|
|
|
|
|
|
options:
|
|
|
|
--desktop create a desktop link
|
|
|
|
--menu create a menu entry
|
|
|
|
--path xx path to the application
|
|
|
|
--link xx name of link to create
|
|
|
|
--args xx command-line arguments for the application
|
|
|
|
--icon xx icon to display
|
|
|
|
--workdir xx working directory for the application
|
|
|
|
--descr xx application description
|
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2001-01-17 21:17:03 +01:00
|
|
|
if [ $# -eq 0 ] ; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2000-11-02 21:22:07 +01:00
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
(--desktop) mode="desktop"; shift 1 ;;
|
|
|
|
(--menu) mode="menu"; shift 1 ;;
|
|
|
|
(--path) path=$2; shift 2 ;;
|
|
|
|
(--link) link=$2; shift 2 ;;
|
|
|
|
(--args) args=$2; shift 2 ;;
|
|
|
|
(--icon) icon=$2; shift 2 ;;
|
|
|
|
(--descr) descr=$2; shift 2 ;;
|
|
|
|
(--workdir) workdir=$2; shift 2 ;;
|
|
|
|
(*) usage ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2001-01-17 21:17:03 +01:00
|
|
|
if [ "$mode" = "" ] ; then
|
|
|
|
echo Either --desktop or --menu required
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$link" = "" ] ; then
|
|
|
|
echo You must specify a link name with --link
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2000-11-02 21:22:07 +01:00
|
|
|
kde_entry()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
# KDE Config File
|
|
|
|
[KDE Desktop Entry]
|
|
|
|
Name=`basename "$link"`
|
|
|
|
Exec=wine "$path" $args
|
|
|
|
Type=Application
|
|
|
|
Comment=$descr
|
|
|
|
EOF
|
|
|
|
[ -z "$workdir" ] || echo "Path=\"$workdir\""
|
|
|
|
[ -z "$xpmicon" ] || echo "Icon=$xpmicon"
|
|
|
|
}
|
|
|
|
|
|
|
|
gnome_entry()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
[Desktop Entry]
|
|
|
|
Name=`basename "$link"`
|
|
|
|
Exec=wine "$path" $args
|
|
|
|
Type=Application
|
|
|
|
Comment=$descr
|
|
|
|
EOF
|
|
|
|
[ -z "$workdir" ] || echo "Path=\"$workdir\""
|
|
|
|
[ -z "$xpmicon" ] || echo "Icon=$xpmicon"
|
|
|
|
}
|
|
|
|
|
|
|
|
# copy the icon file to a specified dir and set xpmicon to the resulting path
|
|
|
|
copy_icon()
|
|
|
|
{
|
|
|
|
dir=$1
|
|
|
|
mkdir -p "$dir"
|
2000-12-14 21:30:35 +01:00
|
|
|
mkdir -p "$dir/""`dirname "$link"`" || true
|
2000-11-02 21:22:07 +01:00
|
|
|
if [ -f "$icon" ]
|
|
|
|
then
|
|
|
|
cp "$icon" "$dir/$link.xpm"
|
|
|
|
xpmicon="$dir/$link.xpm"
|
|
|
|
else
|
|
|
|
xpmicon=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# KDE
|
|
|
|
|
|
|
|
if [ -d "$HOME/.kde" ]
|
|
|
|
then
|
|
|
|
copy_icon "$HOME/.kde/share/applnk/Wine"
|
|
|
|
if [ $mode = "menu" ]
|
|
|
|
then
|
|
|
|
kde_entry > "$HOME/.kde/share/applnk/Wine/$link.kdelnk"
|
2001-01-17 21:17:03 +01:00
|
|
|
|
|
|
|
# KDE 1.x kludge. Wake up KDE, if we can find kpanel running
|
|
|
|
type kwmcom >/dev/null 2>/dev/null && \
|
|
|
|
ps u -C kpanel >/dev/null 2>/dev/null && \
|
|
|
|
kwmcom kpanel:restart
|
|
|
|
|
2000-11-02 21:22:07 +01:00
|
|
|
elif [ -d "$HOME/Desktop" ]
|
|
|
|
then
|
|
|
|
kde_entry > "$HOME/Desktop/$link.kdelnk"
|
2001-01-17 21:17:03 +01:00
|
|
|
# KDE 1.x kludge: wake up KDE, if we can find kfm running...
|
|
|
|
type kfmclient >/dev/null 2>/dev/null && \
|
|
|
|
ps u -C kfm >/dev/null 2>/dev/null && \
|
|
|
|
kfmclient refreshDesktop
|
2000-11-02 21:22:07 +01:00
|
|
|
fi
|
2001-03-08 02:12:52 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "$HOME/.kde2" ]
|
|
|
|
then
|
|
|
|
copy_icon "$HOME/.kde2/share/applnk/Wine"
|
|
|
|
if [ $mode = "menu" ]
|
|
|
|
then
|
2001-03-16 17:40:12 +01:00
|
|
|
gnome_entry > "$HOME/.kde2/share/applnk/Wine/$link.desktop"
|
2001-03-08 02:12:52 +01:00
|
|
|
elif [ -d "$HOME/Desktop2" ]
|
|
|
|
then
|
|
|
|
gnome_entry > "$HOME/Desktop2/$link.desktop"
|
|
|
|
fi
|
2001-01-17 21:17:03 +01:00
|
|
|
|
|
|
|
|
2000-11-02 21:22:07 +01:00
|
|
|
fi
|
|
|
|
|
2001-01-17 21:17:03 +01:00
|
|
|
|
2000-11-02 21:22:07 +01:00
|
|
|
# Gnome
|
|
|
|
|
|
|
|
if [ -d "$HOME/.gnome" ]
|
|
|
|
then
|
|
|
|
copy_icon "$HOME/.gnome/apps/Wine"
|
|
|
|
if [ $mode = "menu" ]
|
|
|
|
then
|
|
|
|
gnome_entry > "$HOME/.gnome/apps/Wine/$link.desktop"
|
|
|
|
elif [ -d "$HOME/.gnome-desktop" ]
|
|
|
|
then
|
|
|
|
gnome_entry > "$HOME/.gnome-desktop/$link.desktop"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|