From 9ba0037babb7024626c43895eb216fda72485960 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Thu, 23 Aug 2012 09:28:56 -0400 Subject: Add an unbind keybinding action, and document in the manpage. Patch provided by Vadim Zhukov , manpage bits by me. --- settings.c | 18 +++++++++++++----- xombrero.1 | 6 ++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/settings.c b/settings.c index e697e20..3140711 100644 --- a/settings.c +++ b/settings.c @@ -1587,13 +1587,13 @@ keybinding_clearall(void) } int -keybinding_add(char *cmd, char *key, int use_in_entry) +keybinding_set(char *cmd, char *key, int use_in_entry) { struct key_binding *k; guint keyval, mask = 0; int i; - DNPRINTF(XT_D_KEYBINDING, "keybinding_add: %s %s\n", cmd, key); + DNPRINTF(XT_D_KEYBINDING, "keybinding_set: %s %s\n", cmd, key); /* Keys which are to be used in entry have been prefixed with an * exclamation mark. */ @@ -1641,6 +1641,14 @@ keybinding_add(char *cmd, char *key, int use_in_entry) break; } + if (strcmp(cmd, "unbind") == 0) { + DNPRINTF(XT_D_KEYBINDING, "keybinding_set: just unbinding: %s\n", + gdk_keyval_name(keyval)); + printf("keybinding_set: just unbinding: %s\n", + gdk_keyval_name(keyval)); + return (0); + } + /* add keyname */ k = g_malloc0(sizeof *k); k->cmd = g_strdup(cmd); @@ -1648,12 +1656,12 @@ keybinding_add(char *cmd, char *key, int use_in_entry) k->use_in_entry = use_in_entry; k->key = keyval; - DNPRINTF(XT_D_KEYBINDING, "keybinding_add: %s 0x%x %d 0x%x\n", + DNPRINTF(XT_D_KEYBINDING, "keybinding_set: %s 0x%x %d 0x%x\n", k->cmd, k->mask, k->use_in_entry, k->key); - DNPRINTF(XT_D_KEYBINDING, "keybinding_add: adding: %s %s\n", + DNPRINTF(XT_D_KEYBINDING, "keybinding_set: adding: %s %s\n", k->cmd, gdk_keyval_name(keyval)); TAILQ_INSERT_HEAD(&kbl, k, entry); @@ -1724,7 +1732,7 @@ add_kb(struct settings *s, char *entry) *kb = '\0'; key = kb + 1; - return (keybinding_add(entry, key, key[0] == '!')); + return (keybinding_set(entry, key, key[0] == '!')); } int diff --git a/xombrero.1 b/xombrero.1 index c47e4fe..6abc90e 100644 --- a/xombrero.1 +++ b/xombrero.1 @@ -144,6 +144,12 @@ is the action and are the keystrokes. .Pp +Actions may be any xombrero command that can be run from the command +prompt. +There is one additional action, +.Cm unbind , +which will unbind any previous actions to that keybinding. +.Pp If the action begins with a colon, the action will be entered into the command prompt instead of being executed. For example, "keybinding = :session open ,M1-s" will open the command -- cgit 1.4.1-2-gfad0