commit 01ac2a87b75aa8633cbe0e8a33dc0e888b8e62f0
parent e26a244e1f391609eca0a08b5774dbc870c75a3b
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Thu, 31 Aug 2006 00:37:55 -0700
[project @ 9db0ab864ff81575692e8141f4d9629a370caeb3]
[project @ 12]
simplify attach & detach client methods
Client#tags
Diffstat:
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/wmii.rb b/wmii.rb
@@ -151,18 +151,13 @@ class Wmii
# Detach the currently selected client
def detachClient
- write '/view/sel/sel/tags', DETACHED_TAG
+ current_client.tags = DETACHED_TAG
end
# Attach the most recently detached client
def attachClient
- if areaList = read("/#{DETACHED_TAG}")
- areaList.split.grep(/^\d+$/).reverse.each do |area|
- if client = read("/#{DETACHED_TAG}/#{area}").split.grep(/^\d+$/).last
- write "/#{DETACHED_TAG}/#{area}/#{client}/tags", read('/view/name')
- return
- end
- end
+ if c = View.new(self, "/#{DETACHED_TAG}").areas.first.clients.first
+ c.tags = read('/view/name')
end
end
@@ -368,8 +363,8 @@ class Wmii
@wm.read("#{@path}/tags").split(TAG_DELIMITER)
end
- def tags= aTags
- @wm.write "#{@path}/tags", aTags.uniq.join(TAG_DELIMITER)
+ def tags= *aTags
+ @wm.write "#{@path}/tags", aTags.flatten.uniq.join(TAG_DELIMITER)
end
# Invokes the given block with this client's tags and reapplies them to this client.