Re: [wmii] wmii snippet: change to previous active view

From: Aaron Grattafiori <Cogitate_AT_sonic.net>
Date: Tue, 18 Sep 2007 18:01:39 -0700 (PDT)

Your functions didn't really work for me, possibly because I use named
tags, possibly because maybe I messed something up. I'm also running on
329 snap.

So.. Here is another way. It also allows you to continually go back and
forth between the two.

NOTE: My MODKEY is mod4 (windows key), if you use mod1 (alt) you should
use another key.

This can probably be cleaned up a bit...
STEPS:
----------------------------------------

1) Everywhere you see "wmiir xwrite /ctl view $foo" just add these two
lines above it:
    PREV_TAG="\$(wmiir read /tag/sel/ctl)"
    PREV_TAG2="\$(wmiir read /tag/sel/ctl)"

** EXCEPT ** for the Action List... don't have the escapes ('\') before
the dollar sign.

2) Then add the Key:

Key $MODKEY-b
    if [ \$PREV_TAG = \$(wmiir read /tag/sel/ctl) ]
    then
        # Previous tag is current tag
        wmiir xwrite /ctl view \$PREV_TAG2 &
    else
        # Set a new variable
        PREV_TAG2=\$(wmiir read /tag/sel/ctl)
        wmiir xwrite /ctl view "\$PREV_TAG" &
    fi
-----------------------------------------------

Then you should always be able to do $MODKEY-b to go back and forth
between the last two windows. You also can use this if you click your tag
names, or use numbers, or words, etc...

I'm open to improvements and suggestions.

 -Aaron Grattafiori

>
>> switch_view() {
>> ptag_tmp=`wmiir read /tag/sel/ctl`
>> wmiir xwrite /ctl view $1
>> PREV_TAG=$ptag_tmp
>> }
>
> obviously ptag_tmp is not needed here, it left from some debugging %)
> so
>
> switch_view() {
> PREV_TAG=`wmiir read /tag/sel/ctl`
> wmiir xwrite /ctl view $1
> }
>
> --
> With best regards,
> Boo-boo
>
> mailto: kaitarou_AT_gmail.com
>
>
Received on Wed Sep 19 2007 - 03:01:41 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:27:56 UTC