31#include <nkutils-bindings.h>
47 .name =
"kb-primary-paste",
48 .binding =
"Control+V,Shift+Insert",
49 .comment =
"Paste primary selection"},
51 .name =
"kb-secondary-paste",
52 .binding =
"Control+v,Insert",
53 .comment =
"Paste clipboard"},
55 .name =
"kb-secondary-copy",
56 .binding =
"Control+c",
57 .comment =
"Copy to clipboard"},
59 .name =
"kb-clear-line",
60 .binding =
"Control+w",
61 .comment =
"Clear input line"},
63 .name =
"kb-move-front",
64 .binding =
"Control+a",
65 .comment =
"Beginning of line"},
67 .name =
"kb-move-end",
68 .binding =
"Control+e",
69 .comment =
"End of line"},
71 .name =
"kb-move-word-back",
72 .binding =
"Alt+b,Control+Left",
73 .comment =
"Move back one word"},
75 .name =
"kb-move-word-forward",
76 .binding =
"Alt+f,Control+Right",
77 .comment =
"Move forward one word"},
79 .name =
"kb-move-char-back",
80 .binding =
"Left,Control+b",
81 .comment =
"Move back one char"},
83 .name =
"kb-move-char-forward",
84 .binding =
"Right,Control+f",
85 .comment =
"Move forward one char"},
87 .name =
"kb-remove-word-back",
88 .binding =
"Control+Alt+h,Control+BackSpace",
89 .comment =
"Delete previous word"},
91 .name =
"kb-remove-word-forward",
92 .binding =
"Control+Alt+d",
93 .comment =
"Delete next word"},
95 .name =
"kb-remove-char-forward",
96 .binding =
"Delete,Control+d",
97 .comment =
"Delete next char"},
99 .name =
"kb-remove-char-back",
100 .binding =
"BackSpace,Shift+BackSpace,Control+h",
101 .comment =
"Delete previous char"},
103 .name =
"kb-remove-to-eol",
104 .binding =
"Control+k",
105 .comment =
"Delete till the end of line"},
107 .name =
"kb-remove-to-sol",
108 .binding =
"Control+u",
109 .comment =
"Delete till the start of line"},
111 .name =
"kb-accept-entry",
112 .binding =
"Control+j,Control+m,Return,KP_Enter",
113 .comment =
"Accept entry"},
115 .name =
"kb-accept-custom",
116 .binding =
"Control+Return",
117 .comment =
"Use entered text as command (in ssh/run modes)"},
119 .name =
"kb-accept-custom-alt",
120 .binding =
"Control+Shift+Return",
121 .comment =
"Use entered text as command (in ssh/run modes)"},
123 .name =
"kb-accept-alt",
124 .binding =
"Shift+Return",
125 .comment =
"Use alternate accept command."},
127 .name =
"kb-delete-entry",
128 .binding =
"Shift+Delete",
129 .comment =
"Delete entry from history"},
131 .name =
"kb-mode-next",
132 .binding =
"Shift+Right,Control+Tab",
133 .comment =
"Switch to the next mode."},
135 .name =
"kb-mode-previous",
136 .binding =
"Shift+Left,Control+ISO_Left_Tab",
137 .comment =
"Switch to the previous mode."},
139 .name =
"kb-mode-complete",
140 .binding =
"Control+l",
141 .comment =
"Start completion for mode."},
143 .name =
"kb-row-left",
144 .binding =
"Control+Page_Up",
145 .comment =
"Go to the previous column"},
147 .name =
"kb-row-right",
148 .binding =
"Control+Page_Down",
149 .comment =
"Go to the next column"},
152 .binding =
"Up,Control+p",
153 .comment =
"Select previous entry"},
155 .name =
"kb-row-down",
156 .binding =
"Down,Control+n",
157 .comment =
"Select next entry"},
159 .name =
"kb-row-tab",
162 "Go to next row, if one left, accept it, if no left next mode."},
164 .name =
"kb-element-next",
166 .comment =
"Go to next element (in logical order)."},
168 .name =
"kb-element-prev",
169 .binding =
"ISO_Left_Tab",
170 .comment =
"Go to next previous element (in logical order)."},
172 .name =
"kb-page-prev",
173 .binding =
"Page_Up",
174 .comment =
"Go to the previous page"},
176 .name =
"kb-page-next",
177 .binding =
"Page_Down",
178 .comment =
"Go to the next page"},
180 .name =
"kb-row-first",
181 .binding =
"Home,KP_Home",
182 .comment =
"Go to the first entry"},
184 .name =
"kb-row-last",
185 .binding =
"End,KP_End",
186 .comment =
"Go to the last entry"},
188 .name =
"kb-row-select",
189 .binding =
"Control+space",
190 .comment =
"Set selected item as input text"},
192 .name =
"kb-screenshot",
194 .comment =
"Take a screenshot of the rofi window"},
196 .name =
"kb-ellipsize",
197 .binding =
"Alt+period",
198 .comment =
"Toggle between ellipsize modes for displayed data"},
200 .name =
"kb-toggle-case-sensitivity",
201 .binding =
"grave,dead_grave",
202 .comment =
"Toggle case sensitivity"},
204 .name =
"kb-toggle-sort",
205 .binding =
"Alt+grave",
206 .comment =
"Toggle sort"},
209 .binding =
"Escape,Control+g,Control+bracketleft",
210 .comment =
"Quit rofi"},
212 .name =
"kb-custom-1",
214 .comment =
"Custom keybinding 1"},
216 .name =
"kb-custom-2",
218 .comment =
"Custom keybinding 2"},
220 .name =
"kb-custom-3",
222 .comment =
"Custom keybinding 3"},
224 .name =
"kb-custom-4",
226 .comment =
"Custom keybinding 4"},
228 .name =
"kb-custom-5",
230 .comment =
"Custom Keybinding 5"},
232 .name =
"kb-custom-6",
234 .comment =
"Custom keybinding 6"},
236 .name =
"kb-custom-7",
238 .comment =
"Custom Keybinding 7"},
240 .name =
"kb-custom-8",
242 .comment =
"Custom keybinding 8"},
244 .name =
"kb-custom-9",
246 .comment =
"Custom keybinding 9"},
248 .name =
"kb-custom-10",
250 .comment =
"Custom keybinding 10"},
252 .name =
"kb-custom-11",
253 .binding =
"Alt+exclam",
254 .comment =
"Custom keybinding 11"},
256 .name =
"kb-custom-12",
258 .comment =
"Custom keybinding 12"},
260 .name =
"kb-custom-13",
261 .binding =
"Alt+numbersign",
262 .comment =
"Custom keybinding 13"},
264 .name =
"kb-custom-14",
265 .binding =
"Alt+dollar",
266 .comment =
"Custom keybinding 14"},
268 .name =
"kb-custom-15",
269 .binding =
"Alt+percent",
270 .comment =
"Custom keybinding 15"},
272 .name =
"kb-custom-16",
273 .binding =
"Alt+dead_circumflex",
274 .comment =
"Custom keybinding 16"},
276 .name =
"kb-custom-17",
277 .binding =
"Alt+ampersand",
278 .comment =
"Custom keybinding 17"},
280 .name =
"kb-custom-18",
281 .binding =
"Alt+asterisk",
282 .comment =
"Custom keybinding 18"},
284 .name =
"kb-custom-19",
285 .binding =
"Alt+parenleft",
286 .comment =
"Custom Keybinding 19"},
288 .name =
"kb-select-1",
289 .binding =
"Super+1",
290 .comment =
"Select row 1"},
292 .name =
"kb-select-2",
293 .binding =
"Super+2",
294 .comment =
"Select row 2"},
296 .name =
"kb-select-3",
297 .binding =
"Super+3",
298 .comment =
"Select row 3"},
300 .name =
"kb-select-4",
301 .binding =
"Super+4",
302 .comment =
"Select row 4"},
304 .name =
"kb-select-5",
305 .binding =
"Super+5",
306 .comment =
"Select row 5"},
308 .name =
"kb-select-6",
309 .binding =
"Super+6",
310 .comment =
"Select row 6"},
312 .name =
"kb-select-7",
313 .binding =
"Super+7",
314 .comment =
"Select row 7"},
316 .name =
"kb-select-8",
317 .binding =
"Super+8",
318 .comment =
"Select row 8"},
320 .name =
"kb-select-9",
321 .binding =
"Super+9",
322 .comment =
"Select row 9"},
324 .name =
"kb-select-10",
325 .binding =
"Super+0",
326 .comment =
"Select row 10"},
328 .name =
"kb-entry-history-up",
329 .binding =
"Control+Up",
330 .comment =
"Go up in the history of the entry box"},
332 .name =
"kb-entry-history-down",
333 .binding =
"Control+Down",
334 .comment =
"Go down in the history of the entry box"},
336 .name =
"kb-matcher-up",
337 .binding =
"Super+equal",
338 .comment =
"Switch to the previous matcher"},
340 .name =
"kb-mather-down",
341 .binding =
"Super+minus",
342 .comment =
"Switch to the next matcher"},
348 .name =
"ml-row-left",
349 .binding =
"ScrollLeft",
350 .comment =
"Go to the previous column"},
353 .name =
"ml-row-right",
354 .binding =
"ScrollRight",
355 .comment =
"Go to the next column"},
359 .binding =
"ScrollUp",
360 .comment =
"Select previous entry"},
363 .name =
"ml-row-down",
364 .binding =
"ScrollDown",
365 .comment =
"Select next entry"},
369 .name =
"me-select-entry",
370 .binding =
"MousePrimary",
371 .comment =
"Select hovered row"},
374 .name =
"me-accept-entry",
375 .binding =
"MouseDPrimary",
376 .comment =
"Accept hovered row"},
379 .name =
"me-accept-custom",
380 .binding =
"Control+MouseDPrimary",
381 .comment =
"Accept hovered row with custom action"},
397 int sl = strlen(b->
name);
398 length = MAX(length, sl);
421 G_GNUC_UNUSED gpointer target,
422 gpointer user_data) {
424 GPOINTER_TO_UINT(user_data))
425 ? NK_BINDINGS_BINDING_TRIGGERED
426 : NK_BINDINGS_BINDING_NOT_TRIGGERED;
430 gpointer user_data) {
432 GPOINTER_TO_UINT(user_data));
438 if (g_strcmp0(b->
name, name) == 0) {
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 config_parser_add_option(XrmOptionType type, const char *key, void **value, const char *comment)
gboolean parse_keys_abe(NkBindings *bindings)
guint key_binding_get_action_from_name(const char *name)
void abe_list_all_bindings(gboolean is_term)
@ SCOPE_MOUSE_LISTVIEW_ELEMENT
@ TOGGLE_CASE_SENSITIVITY
void rofi_add_error_message(GString *str)
RofiViewState * rofi_view_get_active(void)
void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope, guint action)
gboolean rofi_view_check_action(RofiViewState *state, BindingsScope scope, guint action)
ActionBindingEntry rofi_bindings[]
static void binding_trigger_action(guint64 scope, G_GNUC_UNUSED gpointer target, gpointer user_data)
static gboolean binding_check_action(guint64 scope, G_GNUC_UNUSED gpointer target, gpointer user_data)
static const gchar * mouse_default_bindings[]