446 GError *error = NULL;
447 GString *error_msg = g_string_new(
"");
450 char *keystr = g_strdup(b->
binding);
454 const char *
const sep =
",";
455 for (
char *entry = strtok_r(keystr, sep, &sp); entry != NULL;
456 entry = strtok_r(NULL, sep, &sp)) {
459 GUINT_TO_POINTER(b->
id), NULL,
460 NK_BINDINGS_ADD_FLAG_NONE,
462 if (error->code == NK_BINDINGS_ERROR_ALREADY_REGISTERED &&
463 error->domain == NK_BINDINGS_ERROR) {
464 char *str = g_markup_printf_escaped(
465 "Failed to set binding <i>%s</i> for: <i>%s (%s)</i>:\n\t<span "
466 "size=\"smaller\" style=\"italic\">Binding `%s` is already "
468 "\tExecute <b>rofi -list-keybindings</b> to get the current list "
469 "of configured bindings.</span>\n",
471 g_string_append(error_msg, str);
474 char *str = g_markup_printf_escaped(
475 "Failed to set binding <i>%s</i> for: <i>%s (%s)</i>:\n\t<span "
476 "size=\"smaller\" style=\"italic\">%s</span>\n",
478 g_string_append(error_msg, str);
481 g_clear_error(&error);
487 if (error_msg->len > 0) {
498 GSIZE_TO_POINTER(j), NULL,
499 NK_BINDINGS_ADD_FLAG_NONE,
504 g_string_free(error_msg, TRUE);
void rofi_add_error_message(GString *str)