commit 6e2a27810663ce5e06f2f571f116e71b8cdc50a8
parent 18ce840698161c56956db8a50a97a05b99f57377
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Mon, 11 May 2009 23:13:59 -0700
add actions(), events(), and keys() methods for registry listing
Diffstat:
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/config.rb b/config.rb
@@ -50,6 +50,13 @@ def event *a, &b
end
##
+# Returns a list of registered event names.
+#
+def events
+ EVENTS.keys
+end
+
+##
# If a block is given, registers a handler for
# the given action and returns the handler.
#
@@ -60,6 +67,13 @@ def action *a, &b
end
##
+# Returns a list of registered action names.
+#
+def actions
+ ACTIONS.keys
+end
+
+##
# If a block is given, registers a handler for
# the given keypress and returns the handler.
#
@@ -70,6 +84,13 @@ def key *a, &b
end
##
+# Returns a list of registered action names.
+#
+def keys
+ KEYS.keys
+end
+
+##
# Shows a menu (where the user must press keys on their keyboard to
# make a choice) with the given items and returns the chosen item.
#
diff --git a/config.yaml b/config.yaml
@@ -477,7 +477,7 @@ control:
#---------------------------------------------------------------------------
Mod1-Control-i: | # run internal action chosen from a menu
- if choice = key_menu(ACTIONS.keys, 'run action:')
+ if choice = key_menu(actions, 'run action:')
action choice
end
diff --git a/wmiirc b/wmiirc
@@ -47,7 +47,7 @@ begin
event 'FocusTag', curr_tag
# register key bindings
- fs.keys.write KEYS.keys.join("\n")
+ fs.keys.write keys.join("\n")
event('Key') {|*a| key(*a) }
# the main event loop