1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#! /bin/sh
# invoke mined in a newly started rxvt,
# especially on Windows, using the stand-alone (non-X) mode of rxvt
#############################################################################
# set font
size="<SIZE>" # to be replaced later (if used)
font="Lucida Console"
font="Lucida Console-$size"
#font=fixedsys
#############################################################################
# try to configure UTF-8 for rxvt;
# this does not work with the currently available rxvt port to Windows, though
LC_ALL=en_US.UTF-8
export LC_ALL
#############################################################################
# acquire Windows system color and font size settings
# acquire Windows system color settings
color () {
regtool -v get "/HKEY_CURRENT_USER/Control Panel/Colors/$1" 2> /dev/null ||
reg query 'HKEY_CURRENT_USER\Control Panel\Colors' /v $1 |
sed -e "s,.* ,," -e t -e d
}
rgb () {
printf "#%02X%02X%02X" `color $1`
}
setcolors () {
colors="-bg `rgb Window` -fg `rgb WindowText`"
}
# acquire Windows font size settings
# Configured font size from the registry (e.g. "MenuHeight")
# cannot be used as especially Lucida Console scales much larger
# than other fonts and sizes are not comparable among different fonts.
# So use a fixed base size and scale it by configured screen resolution.
metrics () {
regtool -v get "/HKEY_CURRENT_USER/Control Panel/Desktop/WindowMetrics/$1" 2> /dev/null ||
printf "%d" `reg query 'HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics' /v $1 |
sed -e "s,.* ,," -e t -e d`
}
fontsize () {
# expr 0 - `metrics MenuHeight` / 16
expr 14 \* `metrics AppliedDPI` / 100
}
setfont () {
fontsize=`fontsize`
font=`echo "$font" | sed -e "s/\\\$size/$size/" -e "s/$size/$fontsize/"`
}
#############################################################################
# start rxvt with appropriate parameters
#case `uname` in
#CYG*) ;;
#esac
case "$WINDIR" in
"") rxvt -tn rxvt +sb -e mined "$@" &
;;
*) unset DISPLAY
setcolors
setfont
rxvt -tn rxvt +sb -fn "$font" $colors -e mined "$@" &
;;
esac
#############################################################################
# end
|