#!/usr/bin/fish set -x WMII_ADDRESS 'unix!/tmp/ns.jason.:0/wmii' if test (count $argv) = 0 echo "usage: wmii_to_front window-title" exit 1 end set search $argv[1] if test (wmiir read /client/sel/label) = $search #echo "already in front" exit 0 end set clients (wmiir ls /client) for x in $clients set client "/client/"$x set label (wmiir read $client"label") #echo label of client $x is $label if test $label = $search set table (wmiir read /ctl) for row in $table if echo $row | grep -q '^view ' set view (echo $row | sed -e 's/.* //') #echo "current view: $view" end end set tag (wmiir read $client"tags") #echo "client currently has tag: $tag" if test $tag = $view set tmp_tag 1 if test $tmp_tag = $view set tmp_tag 2 end #echo "setting to temporary view $tmp_tag because it's already in this view (view $view)" wmiir xwrite $client"tags" tmp_tag end #echo "moving to this view (view $view)" wmiir xwrite $client"tags" $view exit 0 end end exit 1 # jon Galt pasted this script for me: # # #!/bin/rc # . 9.rc # # view = `{wmiir read /ctl | awk '$1 == view{print $2}'} # regx = $* # # for(cn in `{wmiir ls /client}) { # c = /client/$cn # if(wmiir read $c/label | grep -s $regx) { # ifs=+ { tags = `{wmiir read $c/tags} } # if(! ~ $view $tags) # wmiir xwrite /ctl $tags(1) # #or: wmiir xwrite $c/tags +$view # wmiir xwrite /tag/$view/ctl select client $cn # exit # } # } # # exit exist