This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
First pass at script to build start menu icons
- From: "Brian E. Gallew" <geek at burri dot to>
- To: XFree86 list <cygwin-xfree at cygwin dot com>
- Date: Fri, 08 Aug 2003 03:36:52 -0400
- Subject: First pass at script to build start menu icons
- Reply-to: cygwin-xfree at cygwin dot com
OK, it took me a little longer to get the script to this point than I
would have liked, BUT I'm pretty happy with the results. Comments are
welcome, flames > /dev/null.
#! /bin/sh
# Author: Brian Gallew <geek+@cmu.edu>
TOPFOLDER="$(cygpath -A -P)/Cygwin-XFree86"
#Ensure that a given program is somewhere in the current $PATH
function checkpath () {
c=$(which $1 2> /dev/null)
test ! -z "$c"
}
# Create a shortcut for an application that draws its own windows
# Takes four or five arguments: appname, description folder, the
# offset of the icon , and any arguments
function xapp () {
app="$1"
shift
description="$1"
shift
folder="${TOPFOLDER}/$1"
shift
icon="--icon=/cygwin.ico"
test -z "$2" || icon="--iconoffset=$2"
shift
test -d "${folder}" || mkdir -p "${folder}"
mkshortcut "${icon}" --arguments=${app}\ -display\ :0\ "$@" \
--name="${folder}/${description}" \
--workingdir="${HOME}" /usr/X11R6/bin/run.exe
}
# Create a shortcut for a text-output-only application
function tapp () {
app="$1"
shift
description="$1"
shift
folder="${TOPFOLDER}/$1"
shift
test -d "${folder}" || mkdir -p "${folder}"
mkshortcut --arguments=xterm\ -display\ :0\ -e\ sh\ -c\ \"${app}\ -display\ :0\ "$@"\ "| less"\" \
--name="${folder}/${description}" --icon=/cygwin.ico \
--workingdir="${HOME}" /usr/X11R6/bin/run.exe
test $? -eq 0 && return
echo $app:$description:$folder::
}
#format of an entry here:
#executable name:Description:sub-folder:which function to call:icon offset:arguments
#If the sub-folder is empty, then the icon will be placed in $TOPFOLDER
#the "function to call" should be either xapp or tapp
#If the program provides its own icon in the executable, this is the offset for it (0 based)
#The arguments (if any) will be appended to the command.
X11proggies=(
bitmap:"Bitmap Editor"::xapp::
dpsexec:"Display PostScript command interface":Tools:tapp::
dpsinfo:"The Display PostScript extension":Information:tapp::
editres:"Xaw resource editor":Tools:xapp::
fc-list:"List available FreeType fonts":Information:tapp::
glxgears:"Gear Demo":Toys:xapp::
glxinfo:"GLX information":Information:tapp::
ico:"Bouncing Icosohedron":Toys:xapp::
oclock:"Shaped Clock"::xapp::
showrgb:"List rgb database":Information:tapp::
texteroids:"DPS demo asteroids game":Games:xapp::
viewres:"Xaw resource viewer":Tools:xapp::
vncviewer:"VNC viewer client"::xapp::
wmagnify:"magnifying glass":Tools:xapp::
xbiff:"mail checker"::xapp::
xcalc:"Calculator"::xapp::
xclock:"Clock"::xapp::
xconsole:"Console":Tools:xapp::
xcutsel:"Clipboard manipulator":Tools:xapp::
xditview:"Ditroff output viewer"::xapp::
xdpyinfo:"Display information":Information:tapp::
xdvi:"DVI viewer"::xapp::
xedit:"Simple file editor":Tools:xapp::
xev:"X11 event debugger":Tools:xapp::
xeyes:"Watches the Mouse":Toys:xapp::
xfontsel:"Pick a font":Tools:tapp::
xfsinfo:"The font server":Information:tapp::
xgc:"X11 demo":Toys:xapp::
xkill:"Kill an X11 window":Tools:xapp::
xlogo:"Display the X11 logo":Toys:xapp::
xlsatoms:"List available atoms":Information:tapp::
xlsclients:"List all connected clients":Information:tapp::
xlsfonts:"List all available fonts":Information:tapp::
xmag:"Magnifying glass":Tools:xapp::
xman:"Manual page reader"::xapp::
xmh:"GUI for the MH mail system"::xapp::
xprop:"Display the propertis of a window":Information:tapp::
xrefresh:"Refresh all X11 clients":Tools:xapp::
xterm:"X Terminal"::xapp:0:
xtrapinfo:"The TRAP extension":Information:tapp::
xvinfo:"The X-Video Extension":Information:tapp::
xwd:"Dump X11 window image to file":Tools:tapp::
xwininfo:"A single window":Information:tapp::
gvim:"GUI for VIM"::xapp:0:
emacs:"Editor"::xapp:0:
xemacs:"Editor"::xapp:0:
idle:"Python IDE"::xapp::
rxvt:"RXVT"::xapp:0:
)
for index in $(seq 0 ${#X11proggies[*]})
do
a=${X11proggies[$index]}
test -z "$a" && continue
# This next line breaks up the elements and set $1..$6 appropriately
IFS=":";set $a;unset IFS
checkpath $1
test $? -eq 0 || continue
case $4 in
xapp)
xapp $1 "$2" "$3" $5 $6
;;
tapp)
tapp $1 "$2" "$3" $6
;;
*)
echo `hosed!`
echo $*
esac
done