wmiirc-rumai

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

commit 3ee2853f51eb6887fd02755676a7bc14926495d1
parent 7f3384843bd2b0f695ecd88b850fa69b3eed50b0
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date:   Fri, 29 Sep 2006 08:08:57 -0700

[project @ ebd4f05473279579f4ece7875f35dd6d84c6f1d8]

Fixed problem with reading index (Wmii::Client#index) of currently selected client.
Wmii.find_client now accepts a variable number of places to be searched.

Diffstat:
HISTORY | 4++++
rc.rb | 6++++--
wm.rb | 29+++++++++++++++++++----------
wmiirc-config.rb | 1+
4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/HISTORY b/HISTORY @@ -6,6 +6,10 @@ This is a history of major changes to {my wmii configuration}[http://people.ucsc * Fixed bug in toggle_maximize method (in rc.rb) due to accessing a nonexistent file in IXP file system. * Thanks to Christian von Mueffling for reporting this bug. +* Fixed problem with reading index (Wmii::Client#index) of currently selected client. + +* Wmii.find_client now accepts a variable number of places to be searched. + = 2006-09-28 diff --git a/rc.rb b/rc.rb @@ -162,8 +162,10 @@ end # Numbers the view buttons displayed on the bar, from left to right. def number_view_buttons - Wmii.fs.bar.read.each_with_index do |b, i| - Wmii.fs.bar[b].data = "#{i + 1}:#{b}" + bar = Wmii.fs.bar + + bar.read.each_with_index do |b, i| + bar[b].data = "#{i + 1}:#{b}" end end diff --git a/wm.rb b/wm.rb @@ -69,24 +69,29 @@ module Wmii end # Searches for a client, which has the given ID, in the given places. If no places are specified, then all views are searched. If the client is not found, *nil* is returned. - def Wmii.find_client aClientId, aArea = nil, aView = nil + def Wmii.find_client aClientId, *aPlaces aClientId = aClientId.to_i needle = Wmii.get_client(aClientId) if needle.exist? haystack = [] - if aArea && aArea.exist? - haystack << aArea + # populate the haystack (places to be searched) + aPlaces.select {|p| p.exist?}.each do |place| + if place.respond_to? :clients + haystack << place + end - elsif aView && aView.exist? - haystack.concat aView.areas + if place.respond_to? :areas + haystack.concat place.areas + end + end - else - needle.tags.map {|t| get_view t}.each do |v| - haystack.concat v.areas + if haystack.empty? + needle.tags.map {|t| get_view t}.each do |v| + haystack.concat v.areas + end end - end haystack.each do |a| if a.indices.detect {|i| i == aClientId} @@ -233,6 +238,10 @@ module Wmii super Area, Ixp::Node, :select, *aArgs end + def index + self[:index].read.to_i + end + TAG_DELIMITER = "+" # Returns the tags associated with this client. @@ -555,7 +564,7 @@ class Array if c.is_a?(Wmii::Client) && !c.exist? puts "\n trying to resolve nonexistent client: #{c.path}" if $DEBUG - c = Wmii.find_client(c.basename, nil, Wmii.current_view) + c = Wmii.find_client(c.basename, Wmii.current_view) next unless c puts "resolution OK: #{c.path}" if $DEBUG diff --git a/wmiirc-config.rb b/wmiirc-config.rb @@ -301,6 +301,7 @@ SHORTCUTS = { end end, + # toggle sending the currently selected clients to a temporary view/workspace "#{SEQ_PREFIX}b" => lambda do toggle_temp_view end,