There's also a nice function-ized version that someone in #wmii wrote for me:

get_tags () {
        wmiir read /tags | awk \
        'NR==1{one=$0}; {print}
                END { print one }'
}

cycle_views () {
        dir=$1
        curtag=`wmiir read /view/name`

        if [ "X$dir" = "Xnext" ]; then
                tag=`get_tags | awk -v "cur=$curtag" \
                '$0==cur{getline; print; exit}'`
        elif [ "X$dir" = "Xprev" ]; then
                tag=`get_tags | awk -v "cur=$curtag" \
                'BEGIN {prev=""}
                        $0==cur&&prev!=""{print prev; exit}
                        {prev=$0}'`
        fi
        xwrite /ctl view $tag
}

Then, just call "cycle_views next" or "cycle_views prev".

On 5/30/06, Kris Maglione <[EMAIL PROTECTED]> wrote:
next:
wmiir read /tags |
awk -v cur=`wmiir read /view/name` \
    'NR==1{tag=$0}
     $0==cur { if (getline) tag=$0; printf; exit }'

prev:
wmiir read /tags | sort -r |
awk ...

On Wed, May 31, 2006 at 02:30:38AM +0200, Ren?? Wilhelm wrote:
>On Mon, 29 May 2006 15:29:49 +0300
>[EMAIL PROTECTED] wrote:
>
>> 1) Have the mouse wheel when used on the bar
>> to change the view to previous/next.
>
>How did you achieved to do this? Some time ago i tried to write a sh
>script to do this for me. I thought about putting the output of 'wmiir
>read /tags' into an array and using 'wmiir read /view/name' to get my
>current used view in the array, then referring to array[view+n] or
>array[view-n] to get my new view. with n being the parameter passed to
>the script.
>
>long story made short, i didn't succeeded in the first try writing the
>script did not put anymore work in it. so if you got something useful,
>you could make me happy.

--
Kris Maglione

The simpler the instruction, e.g. "press here", the
more difficult it will be to open the package.

_______________________________________________
[email protected] mailing list
http://wmii.de/cgi-bin/mailman/listinfo/wmii



--
Lead Programmer
G33X Nexus Entertainment
http://games.g33xnexus.com/precursors/

v3sw5/7Hhw5/6ln4pr6Ock3ma7u7+8Lw3/7Tm3l6+7Gi2e4t4Mb7Hen5g8+9ORPa22s6MSr7p6
hackerkey.com

_______________________________________________
[email protected] mailing list
http://wmii.de/cgi-bin/mailman/listinfo/wmii

Reply via email to