Re: [wmii] wmii-4 is dead?

From: Chris Foster <foster_AT_physics.uq.edu.au>
Date: Thu, 31 Aug 2006 11:26:47 +1000

> I also think that automatic tagging is quite insufficent and do not fit that
> well with the tag idea - it tends to turns tags into mere views instead
> role-grouping of the programs, and in many case applications have more than
> one kind of usage (for example web browsers can be used as documentation
> readers, to search the web or to monitor changes to a web page project. I
> don't want to do all these things in a browser tagged "www".)

I agree with what you're saying here, but it is actually possible to fit
automatic tagging with having a browser (say) automatically open for the
task at hand rather than always on a tag such as 'web'. If you search
the archives, you'll notice that I mentioned one way to achieve this a
while ago (I called it the namespace approach). The idea is to modify
/def/rules on the fly, depending on the current tag. In my
implementation:

* Each tag has the form namespace:task
* 'namespace' is meant to be a high-level description of what you're doing,
  while 'task' may be something like web for a browser.
* Whenever wmiirc changes to a new view, it inspects the new tag
  namespace, and modifies /def/rules accordingly.

>From my wmiirc; the namespace initially starts as '' (which I use as a
kind of scratch-space for random tasks):

--------------------------------------------------
wmiir write /def/rules <<EOF
/MPlayer.*:.*/ -> ~
/Gimp.*/ -> ~
/Gimp.*/ -> :float
/Gecko.*/ -> :web
/.*/ -> !
/.*/ -> :
EOF
--------------------------------------------------

On changing the view, wmiirc calls the following:

--------------------------------------------------
changeView()
{
  if [[ -n "$1" ]] ; then
    xwrite /ctl view "$1";
    namespace=$(wmiir read /view/name | sed -e 's/[^:]*$//')
    wmiir read /def/rules | sed -e 's/\([[:alnum:]]*:\)\?\(float\|web\)$/'"$namespace"'\2/' | wmiir write /def/rules
  fi
}
--------------------------------------------------

I also have keybindings for moving left and right between tags *in the
current namespace*. Here's my kludgy implementation from the wmiirc
event loop (I'm sure there must be a better way to do this...)

--------------------------------------------------
                $MODKEY-period|$MODKEY-comma)
      currView=$(wmiir read /view/name)
      newView=''
      reverseFlag=''
      if echo $1 | grep -q comma ; then
        reverseFlag=-r
      fi
      namespace=$(wmiir read /view/name | sed -e 's/[^:]*$//')
      for i in $(wmiir read /tags | grep "^$namespace" | sort $reverseFlag)
      do
        if [[ -n $newView ]] ; then
          newView=$i
          break
        elif [[ $i == $currView ]] ; then
          newView=$currView
        fi
      done
      changeView $newView;;
--------------------------------------------------

I create new namespaces manually via $MODKEY-t :
--------------------------------------------------
                $MODKEY-t)
                        changeView "`wmiir read /tags | wmiimenu`" &;;
--------------------------------------------------
which is somewhat slow, but I haven't been bothered to define special
keybindings for it.

I kind of plan to translate this to python eventually, but I'm a little
tired of tweaking my wm. I admit that I start to want it to "just work"
so I can get on with other stuff.
~Chris.
Received on Thu Aug 31 2006 - 03:26:59 UTC

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