Re: [wmii] next/previous view

From: Kris Maglione <bsdaemon_AT_comcast.net>
Date: Tue, 13 Mar 2007 15:41:38 -0400

On Tue, Mar 13, 2007 at 12:09:33PM +0100, Kai Grossjohann wrote:
>I added the following code to rc.wmii to allow me to move backward and
>forward in the list of tags (views?). The commands shown here cycle
>from the last to the first tag and vice versa.

I've used such shortcuts for some time and have only hesitated to
include them in the default rc.wmii because they are too long, in my
opinion. I don't like your version, simply because it uses non-standard
grep arguments which and a generally confusing way of doing things.
Also, I'm not a fan of emacs-style keybindings. The two keys should be
next to eachother. I use n and b. , and . are fine, as well.

fn next_tag {
        awk -v curtag'='`{wmiir read /tag/sel/ctl} '
                NR==1 {first = $0}
                $0==curtag { if(getline) print $0
                             else print first
                             exit
                }'
}
fn Key-$MODKEY-n { wmiir xwrite /ctl view `{ read_tags | next_tag} }
fn Key-$MODKEY-b { wmiir xwrite /ctl view `{ read_tags | sort -r | next_tag} }

I won't use tac, because it's a nonstandard utility. I've never had any
problems with sort sorting differently from wmii, but I also use p9p
sort, as should rc.wmii for anyone who has it of 9base installed.

I used to have a separate awk script to pick the last tag, but chose
this approach instead because it was more concise.

-- 
Kris Maglione
Workers won't.

Received on Tue Mar 13 2007 - 20:42:51 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:23:39 UTC