#!/bin/sh # user configurable stuffs go here WINDOW_WIDTH=320 WINDOW_HEIGHT=240 CHROME_WIDTH_OFFSET=5 CHROME_HEIGHT_OFFSET=40 # 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=$CHROME_HEIGHT_OFFSET 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"