diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-09-13 13:51:40 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-09-13 13:51:40 +0200 |
commit | 6b74aab3622fc1a403e72d555836203bb926d0bc (patch) | |
tree | 80c82aaad02aaa67723f08a72557b0f2de1039fa | |
parent | cbd6415abad59ea6f3a99d45b03f6dbc83028feb (diff) |
support focusing next/prev window
-rwxr-xr-x | examples/data/uzbl/scripts/instance-select-wmii.sh | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/examples/data/uzbl/scripts/instance-select-wmii.sh b/examples/data/uzbl/scripts/instance-select-wmii.sh index 2c77600..566c103 100755 --- a/examples/data/uzbl/scripts/instance-select-wmii.sh +++ b/examples/data/uzbl/scripts/instance-select-wmii.sh @@ -7,6 +7,7 @@ # When your current uzbl window is maximized, the one you change to # will be maximized as well. # See http://www.uzbl.org/wiki/wmii for more info +# $1 must be one of 'list', 'next', 'prev' COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" @@ -17,13 +18,35 @@ else DMENU="dmenu -i" fi -list= -# get window id's of uzbl clients. we could also get the label in one shot but it's pretty tricky -for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2) -do - label=$(wmiir read /client/$i/label) - list="$list$i : $label\n" -done -window=$(echo -e "$list" | $DMENU $COLORS | cut -d ' ' -f1) -echo "focusing window $window" -wmiir xwrite /tag/sel/ctl "select client $window" +if [ "$1" == 'list' ] +then + list= + # get window id's of uzbl clients. we could also get the label in one shot but it's pretty tricky + for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2) + do + label=$(wmiir read /client/$i/label) + list="$list$i : $label\n" + done + window=$(echo -e "$list" | $DMENU $COLORS | cut -d ' ' -f1) + wmiir xwrite /tag/sel/ctl "select client $window" +elif [ "$1" == 'next' ] +then + current=$(wmiir read /client/sel/ctl | head -n 1) + # find the next uzbl window and focus it + next=$(wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2) + if [ x"$next" != "x" ] + then + wmiir xwrite /tag/sel/ctl "select client $next" + fi +elif [ "$1" == 'prev' ] +then + current=$(wmiir read /client/sel/ctl | head -n 1) + prev=$(wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2) + if [ x"$prev" != "x" ] + then + wmiir xwrite /tag/sel/ctl "select client $prev" + fi +else + echo "\$1 not valid" >&2 + exit 2 +fi |