wmiirc-rumai

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

commit 268c325b587183096841a4a317488ec1cbeed60d
parent c281cc6673aadb8152b2540dd22df9780218cfd8
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Thu, 31 Aug 2006 09:07:32 -0700

[project @ 0dcdeb5809fffa0d8d4b61d0c5a8be3a4cd0a061]

[project @ 27]
fix Wmii#attach_last_client
add mouse-click support for adding & removing tags from the bar

Diffstat:
wmii.rb | 9++++++---
wmiirc | 27+++++++++++++++++++++++----
2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/wmii.rb b/wmii.rb @@ -331,8 +331,10 @@ class Wmii < IxpFile # Attach the most recently detached client def attach_last_client - if c = View.new("/#{DETACHED_TAG}").areas.last.clients.last - c.tags = read('/view/name') + if a = View.new("/#{DETACHED_TAG}").areas.first + if c = a.clients.first + c.tags = read('/view/name') + end end end @@ -434,7 +436,8 @@ class Wmii < IxpFile # Modifies the tags associated with this client. def tags= *aTags - write "#{@path}/tags", aTags.flatten.uniq.join(TAG_DELIMITER) + t = aTags.flatten.uniq + write "#{@path}/tags", t.join(TAG_DELIMITER) unless t.empty? end # Invokes the given block within the context of this client's list of tags. diff --git a/wmiirc b/wmiirc @@ -353,7 +353,10 @@ SHORTCUTS = { ('a'..'z').each do |char| SHORTCUTS["#{MENU}v,#{char}"] = lambda do - if view = WM.tags.select {|t| t =~ /^#{char}/i}.first + choices = WM.tags + choices.delete WM.current_view.name + + if view = choices.select {|t| t =~ /^#{char}/i}.first WM.focus_view view end end @@ -391,15 +394,31 @@ begin while event = io.readline.chomp type, arg = event.split($;, 2) - p event, type, arg if $DEBUG - case type when 'Start' exit if arg == 'wmiirc' when 'BarClick' view, button = arg.split - WM.focus_view view + + case button.to_i + when 1 + WM.focus_view view + + when 2 + WM.selected_clients.each do |c| + c.with_tags do + push view + end + end + + when 3 + WM.selected_clients.each do |c| + c.with_tags do + delete view + end + end + end when 'ClientClick' client, button = arg.split