wmiirc-rumai

git clone git://oldgit.suckless.org/wmiirc-rumai/
Log | Files | Refs | README | LICENSE

commit 2d5eae150d723b06a473a23c523437dae135becf
parent f3ce5c74c08d0e449d2abea27e882fa266edda7b
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Sun, 24 Sep 2006 03:24:55 -0700

[project @ 23358117002d5792e6ab084dbaf6222f8e9a482b]

[project @ 131]
move alpha view access into focus_view_matching method

Diffstat:
rc.rb | 14++++++++++++++
wmiirc-config.rb | 11+----------
2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/rc.rb b/rc.rb @@ -146,6 +146,20 @@ def toggle_maximize end end +# Focuses the view whose name matches the given pattern. If more than one view matches, then they are cycled (adapted from Fredrik Ternerot). +def focus_view_matching aPattern + choices = Wmii.tags.grep(aPattern) + + unless choices.empty? + curIdx = choices.index(Wmii.current_view.name) + maxIdx = choices.length + + idx = curIdx.next % maxIdx rescue 0 + + Wmii.focus_view choices[idx] + end +end + ## wmii-2 style client detaching diff --git a/wmiirc-config.rb b/wmiirc-config.rb @@ -393,18 +393,9 @@ SHORTCUTS = { end # jump to view whose name begins with the pressed key. -# if more than one view matches, then they are cycled (adapted from Fredrik Ternerot). ('a'..'z').each do |key| SHORTCUTS["#{MENU_SEQ}v,#{key}"] = lambda do - choices = Wmii.tags.select {|t| t =~ /^#{key}/i} - - unless choices.empty? - curIdx = choices.index(Wmii.current_view.name) - maxIdx = choices.length - idx = curIdx.next % maxIdx rescue 0 - - Wmii.focus_view choices[idx] - end + focus_view_matching(/^#{key}/i) end end