wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit ea79a8c1b939a0de7f491d61f31c9e854fc5f340
parent 5c506656f5bb7a285eb65ba990ad5b1bbb30c85e
Author: Kris Maglione <jg@suckless.org>
Date:   Fri,  9 Oct 2009 16:40:33 -0400

Allow client to follow tag change in python wmiirc.

Diffstat:
alternative_wmiircs/python/pygmi/fs.py | 16+++++++++++++---
alternative_wmiircs/python/wmiirc.py | 10++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/alternative_wmiircs/python/pygmi/fs.py b/alternative_wmiircs/python/pygmi/fs.py @@ -575,7 +575,17 @@ class Tags(object): return tags[i+1] return self.sel - def select(self, tag): + def select(self, tag, take_client=None): + def goto(tag): + if take_client: + sel = Tag('sel').id + take_client.tags = '+%s' % tag + wmii['view'] = tag + if tag != sel: + take_client.tags = '-%s' % sel + else: + wmii['view'] = tag + if tag is self.PREV: if self.sel.id not in self.ignore: self.idx -= 1 @@ -584,7 +594,7 @@ class Tags(object): else: if isinstance(tag, Tag): tag = tag.id - wmii['view'] = tag + goto(tag) if tag not in self.ignore: if self.idx < -1: @@ -599,6 +609,6 @@ class Tags(object): return self.idx = constrain(-len(self.mru), -1, self.idx) - wmii['view'] = self.mru[self.idx] + goto(self.mru[self.idx]) # vim:se sts=4 sw=4 et: diff --git a/alternative_wmiircs/python/wmiirc.py b/alternative_wmiircs/python/wmiirc.py @@ -227,10 +227,20 @@ keys.bind('main', ( lambda k: tags.select(tags.next())), ('%(mod)s-b', "Move to the view to the right", lambda k: tags.select(tags.next(True))), + ('%(mod)s-Shift-n', "Move to the view to the left, take along current client", + lambda k: tags.select(tags.next(), take_client=Client('sel'))), + ('%(mod)s-Shift-b', "Move to the view to the right, take along current client", + lambda k: tags.select(tags.next(True), take_client=Client('sel'))), + ('%(mod)s-i', "Move to the newer tag in the tag stack", lambda k: tags.select(tags.NEXT)), ('%(mod)s-o', "Move to the older tag in the tag stack", lambda k: tags.select(tags.PREV)), + ('%(mod)s-Shift-i', "Move to the newer tag in the tag stack, take along current client", + lambda k: tags.select(tags.NEXT, take_client=Client('sel'))), + ('%(mod)s-Shift-o', "Move to the older tag in the tag stack, take along current client", + lambda k: tags.select(tags.PREV, take_client=Client('sel'))), + )) def bind_num(i): keys.bind('main', (