commit ca23379523afb0558929bde8e49fc771273d40d7
parent 5be037c5ddbf28c5d22249d6e4f8fc95858cce7c
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Mon, 18 Sep 2006 01:45:21 -0700
[project @ 48e2a3db8617b616cfbe8c761a3c861423565efa]
[project @ 105]
* Added View#empty? and Area#empty? methods.
* change_tag_from_menu now returns the chosen tag.
Diffstat:
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/HISTORY b/HISTORY
@@ -1,6 +1,12 @@
This is a history of major changes to {my wmii configuration}[http://people.ucsc.edu/~skurapat/wmii.html].
+= 2006-09-17
+
+* Added View#empty? and Area#empty? methods.
+* change_tag_from_menu now returns the chosen tag.
+
+
= 2006-09-16
* Fixed toggling of maximization of currently focused client, via toggle_maximize in rc.rb.
diff --git a/rc.rb b/rc.rb
@@ -63,7 +63,7 @@ def focus_client_from_menu
end
end
-# Changes the tag, chosen from a menu, of each selected client.
+# Changes the tag, chosen from a menu, of each selected client and returns the chosen tag.
# The {+tag -tag idea}[http://zimbatm.oree.ch/articles/2006/06/15/wmii-3-and-ruby] is from Jonas Pfenniger.
def change_tag_from_menu
choices = Wmii.tags.map {|t| [t, "+#{t}", "-#{t}"]}.flatten
@@ -82,6 +82,8 @@ def change_tag_from_menu
c.tags = target
end
end
+
+ target
end
end
diff --git a/wm.rb b/wm.rb
@@ -301,6 +301,11 @@ module Wmii
alias clients children
+ # Tests if this area is empty (has no clients).
+ def empty?
+ length < 1
+ end
+
# Inserts the given clients at the bottom of this area.
def push! *aClients
if target = clients.last
@@ -409,6 +414,13 @@ module Wmii
alias areas children
+ # Tests if this view is empty (has no clients).
+ def empty?
+ length < 3 &&
+ self[0].length < 1 &&
+ self[1].length < 1
+ end
+
# Iterates over columns in this view such that destructive operations are supported. If specified, the iteration starts with the column which has the given index.
# Note that the floating area is not considered to be a column.
def each_column aStartIdx = 1 # :yields: area