4 #coor[0]="0,0,0,560,650"
5 #coor[1]="0,443,108,560,650"
6 #coor[2]="0,878,197,560,650"
7 coor[0]="0,0,0,840,975"
8 coor[1]="0,863,0,840,975"
9 coor[2]="0,1712,0,840,975"
10 coor[3]="0,863,300,840,975"
11 coor[4]="0,1712,300,840,975"
14 # TODO: pids2wids function IN: pids OUT: associated windows ids
17 if [ "$1" = "-v" ]; then
18 ps ax | egrep '[0-9] /usr/lib/firefox/firefox -no-remote -P (one|two|three|four|five) ' | grep -v grep | sed 's/^ *//g;s/ .*-P//g;s/ http.*//g'
20 ps ax | egrep '[0-9] /usr/lib/firefox/firefox -no-remote -P (one|two|three|four|five) ' | grep -v grep | sed 's/^ *//g;s/ .*//g'
24 rearrange_windows () {
28 wids="$(wmctrl -l -p | sed 's/ \+/|/g' | cut -d '|' -f 1,3 | egrep "\|(${pids[0]}|${pids[1]}|${pids[2]}|${pids[3]}|${pids[4]})$")"
29 l="$(echo "$wids" | wc -l)"
31 for i in $(seq 0 4); do
32 wid="$(echo "$wids" | grep "|${pids[$i]}\$" | cut -d '|' -f 1)"
33 wmctrl -i -r $wid -e ${coor[$i]}
39 if [ $ct -gt 10 ]; then
48 HOMEPAGE="http://dodo.birds.van/brisk/index.php"
49 if [ "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ]; then
50 echo "$0 - run firefoxes"
51 echo "$0 list [-v] - list firefoxes"
52 echo "$0 <stop|cont|term|kill> - send signal to firefoxes"
53 echo "$0 help - this help"
54 elif [ "$1" = "list" ]; then
56 elif [ "$1" = "stop" -o "$1" = "cont" -o "$1" = "term" -o "$1" = "kill" ]; then
65 elif [ "$1" = "rearrange" ]; then
69 for i in one two three four five; do
70 pids[$ct]="$(echo "$list" | grep -- " $i$" | sed 's/ .*//g')"
74 elif [ $# -eq 0 ]; then
76 for i in one two three four five; do
77 firefox -no-remote -P $i "$HOMEPAGE?whoami=$i" &