From dae6963b24c8692358119d46e218ab10ad74b0d7 Mon Sep 17 00:00:00 2001 From: Donald Burr Date: Thu, 19 Feb 2015 18:35:15 -0800 Subject: [PATCH] add fixer script --- acatcher/fix_windows.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/acatcher/fix_windows.sh b/acatcher/fix_windows.sh index 1b658cd..5de6daf 100755 --- a/acatcher/fix_windows.sh +++ b/acatcher/fix_windows.sh @@ -9,7 +9,33 @@ CHROME_HEIGHT_OFFSET=20 # end of user configurable section +# need room file +if [ ! -f "$1" ]; then + echo "ERROR: need room file" + exit 1 +fi + # get screen width and height WIDTH=`xdpyinfo | grep dimensions | awk '{print $2}' | awk -Fx '{print $1}'` HEIGHT=`xdpyinfo | grep dimensions | awk '{print $2}' | awk -Fx '{print $2}'` echo "display is $WIDTH x $HEIGHT" + +# start at 0,0 +X=0 +Y=0 +NUM=0 + +while read ROOM; do + HEX="`echo "obase=16; $NUM" | bc | tr '[A-Z]' '[a-z]'`" + echo "check $ROOM num $NUM hex $HEX" + WINTITLE="[$HEX] $ROOM" + echo "moving $WINTITLE to $X,$Y" + wmctrl -Fr "$WINTITLE" -e "0,$X,$Y,$WINDOW_WIDTH,$WINDOW_HEIGHT" + NUM=$((NUM+1)) + X=$((X+WINDOW_WIDTH+CHROME_WIDTH_OFFSET)) + if [ $X -gt $WIDTH ]; then + echo "new row" + X=0 + Y=$((Y+WINDOW_HEIGHT+CHROME_HEIGHT_OFFSET)) + fi +done < "$1"