#! /bin/ksh # gv: gvim covers starting console window {{{2 # when making changes, don't forget to . .kalias function gv { if [[ "${WINDOWID}" = "" ]]; then # echo "***error*** unknown window id!" return fi xwi=$(xwininfo -id $WINDOWID) xyposn=${xwi##*Corners: } xyposn=${xyposn%% -*} wh=${xwi##*geometry } wh=${wh%%[-+]*} integer x y w h x=${xyposn%+[0-9]*} y=${xyposn##*+} w=${wh%x*} hh=${wh#*x} h=${hh%%[-+]*} # ---------------------------------------------------------- # Adjustments: account for window borders, menus, fontsizes # ---------------------------------------------------------- # Adjust for FC4 Linux: Luxi Mono Bold 10 h=26 w=160 # sanity checks if (( x < 0 )); then x=0 fi if (( y < 0 )); then y=0 fi if (( h < 0 )); then h=0 fi # ---------------------------------------------------------- # execute gvim with geometry if [[ "$@" = "" ]]; then gvim -geometry "${w}x${h}+${x}+${y}" . else gvim -geometry "${w}x${h}+${x}+${y}" "$@" fi }