commit 9e9e4fd31e174c63c9ab4e45cc9ec06b151ac735
parent 1b4686f85df05aadd65891cba335a5d76fb7e127
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Wed, 13 Sep 2006 21:26:55 -0700
[project @ 8249e23e3c3aaf067c2680b224d3f8656db6d338]
[project @ 90]
add Wmii.client to avoid use of explicit fs paths
Diffstat:
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/wm.rb b/wm.rb
@@ -58,10 +58,15 @@ module Wmii
Area.new("/client").clients
end
- # Searches for the client with the given ID and returns it. If the client is not found, *nil* is returned. The search is performed within the given places if they are specified.
+ # Returns the client which has the given ID.
+ def Wmii.client aId
+ Client.new("/client/#{aId}")
+ end
+
+ # Searches for a client, which has the given ID, in the given places. If no places are specified, the current view is searched. If the client is not found, *nil* is returned.
def Wmii.find_client aClientId, aArea = nil, aView = nil
aClientId = aClientId.to_i
- needle = Client.new("/client/#{aClientId}")
+ needle = Wmii.client(aClientId)
if needle.exist?
areas = []
@@ -99,13 +104,13 @@ module Wmii
end
# Focuses the area with the given ID in the current view.
- def Wmii.focus_area aAreaId
- Wmii.current_view[aAreaId].focus!
+ def Wmii.focus_area aId
+ Wmii.current_view[aId].focus!
end
# Focuses the client which has the given ID.
- def Wmii.focus_client aClientId
- if c = find_client(aClientId)
+ def Wmii.focus_client aId
+ if c = find_client(aId)
v = (a = c.parent).parent
v.focus!
diff --git a/wmiirc-config.rb b/wmiirc-config.rb
@@ -453,7 +453,7 @@ begin
clickedClient, clickedButton = arg.split
if clickedButton.to_i != PRIMARY_CLICK
- Wmii::Client.new("/client/#{clickedClient}").invert_selection!
+ Wmii.client(clickedClient).invert_selection!
end
when :Key