4 coor[0]="0,0,0,560,650"
5 coor[1]="0,443,108,560,650"
6 coor[2]="0,878,197,560,650"
9 # TODO: pids2wids function IN: pids OUT: associated windows ids
12 if [ "$1" = "-v" ]; then
13 ps ax | egrep '[0-9] /usr/lib/firefox/firefox -no-remote -P (one|two|three) ' | grep -v grep | sed 's/^ *//g;s/ .*-P//g;s/ http.*//g'
15 ps ax | egrep '[0-9] /usr/lib/firefox/firefox -no-remote -P (one|two|three) ' | grep -v grep | sed 's/^ *//g;s/ .*//g'
19 rearrange_windows () {
23 wids="$(wmctrl -l -p | sed 's/ \+/|/g' | cut -d '|' -f 1,3 | egrep "\|(${pids[0]}|${pids[1]}|${pids[2]})$")"
24 l="$(echo "$wids" | wc -l)"
26 for i in $(seq 0 2); do
27 wid="$(echo "$wids" | grep "|${pids[$i]}\$" | cut -d '|' -f 1)"
28 wmctrl -i -r $wid -e ${coor[$i]}
34 if [ $ct -gt 10 ]; then
43 HOMEPAGE="http://dodo.birds.van/brisk/index.php"
44 if [ "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ]; then
45 echo "$0 - run firefoxes"
46 echo "$0 list [-v] - list firefoxes"
47 echo "$0 <stop|cont|term|kill> - send signal to firefoxes"
48 echo "$0 help - this help"
49 elif [ "$1" = "list" ]; then
51 elif [ "$1" = "stop" -o "$1" = "cont" -o "$1" = "term" -o "$1" = "kill" ]; then
60 elif [ "$1" = "rearrange" ]; then
64 for i in one two three; do
65 pids[$ct]="$(echo "$list" | grep -- " $i$" | sed 's/ .*//g')"
69 elif [ $# -eq 0 ]; then
71 for i in one two three; do
72 firefox -no-remote -P $i "$HOMEPAGE?whoami=$i" &