oui Yes, I do have a script which does the trick, tough it uses perl and wm/wmctrl:
#!/bin/sh
if [ -x /usr/pkg/bin/wmctrl ]; then
# window name
wname=$(xwininfo -id "window_id" | perl -ne \
'print $1 if /"(.*)"\s*$/')
# display resolution
dim() {
xdpyinfo | grep dimensions | grep -o '[0-9x]*' | head -n1
}
# window placement
pos() {
wmctrl -lG | grep "$wname" | perl -nle \
\ '@a=split;print join "\t", @a[2..5]'
}
dim | while IFS='x' read sw sh
do
pos | while read wx wy ww wh; do
wmctrl -r $wname -e 0,$(expr $sw / 2 - \
$ww / 2),$(expr $sh / 2 - $wh / 2),$ww,$wh
done
done
else
return 0
fi
Once invoked, this lets you interactively select the windows to center with mouse (left click) and warps it tothe center of the screen.
You can bind it inside ~/.ctwmrc as follows (I have it bound to Alt + g):
# scripts path
define(`bindir',`/home/logname/.bin')
# Center window
"g" = mod1 : all : f.exec "bindir/center &"