commit 8971761777ee9ec33d09c3e2b6d7f8d18551f5e5
parent 6891941013de08a4c38b74db404f1e6b2977f02e
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Thu, 31 Aug 2006 01:41:49 -0700
[project @ da717d2b73b25f8d45357ee73046cb2ccee59d1c]
[project @ 16]
fix grouping shortcuts
add error throwing in IXPFile#method_missing if path unreadable
Diffstat:
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/wmii.rb b/wmii.rb
@@ -65,21 +65,25 @@ class Wmii
View.new(self, "/#{SELECTION_TAG}").unselect!
end
- # Invokes the given block upon all selected clients in the current view. If there are no selected clients, then the block is invoked upon the currently focused client.
- def with_selection # :yields: client
- # determine selected clients in current view
- clientList = current_view.areas.map do |a|
- a.clients.select do |c|
- c.tags.include? SELECTION_TAG
- end
+ # Returns a list of all selected clients in the current view. If there are no selected clients, then the currently focused client is returned in the list.
+ def selection
+ clientList = current_view.areas.map do |a|
+ a.clients.select do |c|
+ c.tags.include? SELECTION_TAG
end
- clientList.flatten!
+ end
+ clientList.flatten!
if clientList.empty?
clientList << current_client
end
- clientList.each do |c|
+ clientList
+ end
+
+ # Invokes the given block upon all selected clients in the current view. If there are no selected clients, then the block is invoked upon the currently focused client.
+ def with_selection # :yields: client
+ selection.each do |c|
c.focus!
yield c
end
@@ -329,7 +333,11 @@ class Wmii
end
def method_missing aMeth
- @wm.read("#{@path}/#{aMeth}")
+ if content = @wm.read("#{@path}/#{aMeth}")
+ content
+ else
+ super
+ end
end
end
diff --git a/wmiirc b/wmiirc
@@ -103,8 +103,9 @@ SHORTCUTS = {
"#{LAYOUT}t" => lambda do WM.applyTilingLayout end,
"#{LAYOUT}g" => lambda do WM.applyGridLayout end,
- "#{GROUP}g" => lambda do WM.current_client.select! end,
+ "#{GROUP}g" => lambda do WM.current_client.invert_selection! end,
"#{GROUP}a" => lambda do WM.current_view.select! end,
+ "#{GROUP}i" => lambda do WM.current_view.invert_selection! end,
"#{GROUP}n" => lambda do WM.select_none end,