From 9dc80f8f7317ed1df6775bb63815d686a88fb2a4 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Thu, 17 Nov 2022 17:41:43 +0100 Subject: [PATCH] small updates --- source/keyb.c | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/source/keyb.c b/source/keyb.c index c035c672..4ae01753 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -24,12 +24,12 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#include +#include "config.h" #include "rofi.h" #include "xrmoptions.h" #include +#include #include -#include "nkutils-bindings.h" typedef struct { guint id; @@ -373,7 +373,7 @@ static const gchar *mouse_default_bindings[] = { [MOUSE_DCLICK_UP] = "!MouseDPrimary", }; -void abe_list_all_bindings(gboolean is_term ) { +void abe_list_all_bindings(gboolean is_term) { int length = 0; for (gsize i = 0; i < G_N_ELEMENTS(rofi_bindings); ++i) { @@ -384,9 +384,10 @@ void abe_list_all_bindings(gboolean is_term ) { for (gsize i = 0; i < G_N_ELEMENTS(rofi_bindings); ++i) { ActionBindingEntry *b = &rofi_bindings[i]; if (is_term) { - printf("%s%*s%s - %s\n", color_bold,length, b->name, color_reset,b->binding); + printf("%s%*s%s - %s\n", color_bold, length, b->name, color_reset, + b->binding); } else { - printf("%*s - %s\n", length, b->name, b->binding); + printf("%*s - %s\n", length, b->name, b->binding); } } } @@ -440,22 +441,25 @@ gboolean parse_keys_abe(NkBindings *bindings) { if (!nk_bindings_add_binding(bindings, b->scope, entry, binding_check_action, binding_trigger_action, GUINT_TO_POINTER(b->id), NULL, &error)) { - if ( error->code == NK_BINDINGS_ERROR_ALREADY_REGISTERED && error->domain == NK_BINDINGS_ERROR){ - char *str = g_markup_printf_escaped( - "Failed to set binding %s for: %s (%s):\n\tBinding `%s` is already bound.\n" - "\tExecute rofi -list-keybindings to get the current list of configured bindings.\n", - b->binding, b->comment, b->name, entry); - g_string_append(error_msg, str); - g_free(str); - } else { - char *str = g_markup_printf_escaped( - "Failed to set binding %s for: %s (%s):\n\t%s\n", - b->binding, b->comment, b->name, error->message); - g_string_append(error_msg, str); - g_free(str); - } + if (error->code == NK_BINDINGS_ERROR_ALREADY_REGISTERED && + error->domain == NK_BINDINGS_ERROR) { + char *str = g_markup_printf_escaped( + "Failed to set binding %s for: %s (%s):\n\tBinding `%s` is already " + "bound.\n" + "\tExecute rofi -list-keybindings to get the current list " + "of configured bindings.\n", + b->binding, b->comment, b->name, entry); + g_string_append(error_msg, str); + g_free(str); + } else { + char *str = g_markup_printf_escaped( + "Failed to set binding %s for: %s (%s):\n\t%s\n", + b->binding, b->comment, b->name, error->message); + g_string_append(error_msg, str); + g_free(str); + } g_clear_error(&error); } }