If the fccHandler is mmioFOURCC(0, 0, 0, 0) the AVI is also
[wine/multimedia.git] / tools / wineshelllink
blob16776f818a39b246ef54d867170f545ff7fc847d
1 #!/bin/sh
3 # Create menu/desktop entries for an application
4 # This is used by the IShellLink interface
6 # Copyright 2000 Alexandre Julliard
8 mode=""
9 args=""
10 menu=""
11 icon=""
12 descr=""
13 link=""
14 path=""
15 workdir=""
17 usage()
19 cat <<EOF
20 usage: wineshelllink options
22 options:
23 --desktop create a desktop link
24 --menu create a menu entry
25 --path xx path to the application
26 --link xx name of link to create
27 --args xx command-line arguments for the application
28 --icon xx icon to display
29 --workdir xx working directory for the application
30 --descr xx application description
32 EOF
33 exit 1
36 if [ $# -eq 0 ] ; then
37 usage
40 while [ $# -gt 0 ]
42 case "$1" in
43 --desktop) mode="desktop"; shift 1 ;;
44 --menu) mode="menu"; shift 1 ;;
45 --path) path="$2"; shift 2 ;;
46 --link) link="$2"; shift 2 ;;
47 --args) args="$2"; shift 2 ;;
48 --icon) icon="$2"; shift 2 ;;
49 --descr) descr="$2"; shift 2 ;;
50 --workdir) workdir="$2"; shift 2 ;;
51 *) usage ;;
52 esac
53 done
55 if [ "$mode" = "" ] ; then
56 echo Either --desktop or --menu required
57 usage
60 if [ "$link" = "" ] ; then
61 echo You must specify a link name with --link
62 usage
65 kde_entry()
67 xname=`basename "$link"`
68 cat <<EOF
69 # KDE Config File
70 [KDE Desktop Entry]
71 Name=$xname
72 Exec=wine "$path" $args
73 Type=Application
74 Comment=$descr
75 EOF
76 [ -z "$workdir" ] || echo "Path=\"$workdir\""
77 [ -z "$xpmicon" ] || echo "Icon=$xpmicon"
80 gnome_entry()
82 xname=`basename "$link"`
83 cat <<EOF
84 [Desktop Entry]
85 Name=$xname
86 Exec=wine "$path" $args
87 Type=Application
88 Comment=$descr
89 EOF
90 [ -z "$workdir" ] || echo "Path=\"$workdir\""
91 [ -z "$xpmicon" ] || echo "Icon=$xpmicon"
94 mdk_entry()
96 base=`basename "$link"`
97 section=`dirname "$link"`
98 [ -z "$icon" ] || xicon="icon=\"$xpmicon\""
99 echo "?package(local.Wine):needs=x11 section=\"Wine/$section\" title=\"$base\" longtitle=\"$descr\" command=\"wine \\\"$path\\\" $args\" $xicon"
102 # copy the icon file to a specified dir and set xpmicon to the resulting path
103 copy_icon()
105 dir="$1"
106 mkdir -p "$dir"
107 mkdir -p "$dir/""`dirname "$link"`" || true
108 if [ -f "$icon" ]
109 then
110 cp "$icon" "$dir/$link.xpm"
111 xpmicon="$dir/$link.xpm"
112 else
113 xpmicon=""
117 # Debian/Mandrake
119 type update-menus > /dev/null 2>&1
120 if [ $? = 0 -a $mode = "menu" ]
121 then
122 iconname="`basename "$link"`.xpm"
123 dir="$HOME/.menu/icons"
124 if [ -f "$icon" ]
125 then
126 mkdir -p "$dir"
127 cp "$icon" "$dir/$iconname"
128 xpmicon="$dir/$iconname"
129 else
130 xpmicon=""
132 mdk_entry >> "$HOME/.menu/wine"
133 update-menus > /dev/null 2>&1
136 # KDE
138 if [ -d "$HOME/.kde" ]
139 then
140 copy_icon "$HOME/.kde/share/applnk/Wine"
141 if [ $mode = "menu" ]
142 then
143 kde_entry > "$HOME/.kde/share/applnk/Wine/$link.kdelnk"
145 # KDE 1.x kludge. Wake up KDE, if we can find kpanel running
146 type kwmcom >/dev/null 2>/dev/null && \
147 ps u -C kpanel >/dev/null 2>/dev/null && \
148 kwmcom kpanel:restart
150 elif [ -d "$HOME/Desktop" ]
151 then
152 kde_entry > "$HOME/Desktop/$link.kdelnk"
153 # KDE 1.x kludge: wake up KDE, if we can find kfm running...
154 type kfmclient >/dev/null 2>/dev/null && \
155 ps u -C kfm >/dev/null 2>/dev/null && \
156 kfmclient refreshDesktop
160 if [ -d "$HOME/.kde2" ]
161 then
162 copy_icon "$HOME/.kde2/share/applnk/Wine"
163 if [ $mode = "menu" ]
164 then
165 gnome_entry > "$HOME/.kde2/share/applnk/Wine/$link.desktop"
166 elif [ -d "$HOME/Desktop2" ]
167 then
168 gnome_entry > "$HOME/Desktop2/$link.desktop"
175 # Gnome
177 if [ -d "$HOME/.gnome" ]
178 then
179 copy_icon "$HOME/.gnome/apps/Wine"
180 if [ $mode = "menu" ]
181 then
182 gnome_entry > "$HOME/.gnome/apps/Wine/$link.desktop"
183 elif [ -d "$HOME/.gnome-desktop" ]
184 then
185 gnome_entry > "$HOME/.gnome-desktop/$link.desktop"
189 exit 0