[wmii] Code Snippet view all clients on specific tag (idea)

From: Ruben Gonzalez Arnau <ruben_AT_websbarcelona.com>
Date: Sat, 22 Mar 2008 04:20:53 +0100

Hello list,

I am trying to see all clients in a specific tag, maybe for some people
using current tag (sel) is preferred, but I prefer to user another tag
called for example vall (var $tagall) or something instead of touching
my current tag. This is an idea how to use, maybe it's useful for some
people :)

on $home/.wmii-3.5/rc.wmii.local

# get current tag name
fn getcurtag {
         wmiir read /tag/sel/ctl | sed 1q
}

# get all clients (clients are in hex)
fn getclients {
         wmiir ls /client | sed -n '/^0x[a-fA-F0-9]/s/\/$//p'
}

# view all tags on $tagall
# put you name here, I use 'vall' since for me is the latest tag name
tagall = vall
fn viewall {
         curtag = `{getcurtag}
         if(! ~ $curtag $tagall) {
                 prevtag = $curtag
                 for(tag in `{getclients}) {
                          ntag = `{wmiir read /client/$tag/tags}
                          wmiir xwrite /client/$tag/tags $ntag+$tagall
                 }
                 wmiir xwrite /ctl view $tagall
         }
}
fn unviewall {
         if(~ `{getcurtag} $tagall)
                 wmiir xwrite /ctl view $prevtag
         for(tag in `{wmiir read /tag/$tagall/index | awk
'/0x[a-fA-F0-9]/ { print $2 }'}) {
                 ntag = `{wmiir read /client/$tag/tags | sed s/\+$tagall//}
                 wmiir xwrite /client/$tag/tags $ntag
         }
}

# for example $MODKEY-F12, I use $MODKEY-0
fn Key-$MODKEY-F12 {
         viewall
}
fn Key-$MODKEY-Shift-F12 {
         unviewall
}

All ideas are welcome :)

Thank you

-- 
Ruben Gonzalez Arnau
GPG key: 0x08AF5CD4 http://www.websbarcelona.com/ruben/0x08AF5CD4.asc
Received on Sat Mar 22 2008 - 04:21:33 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:38:35 UTC