29#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-clear-line",
56 .binding =
"Control+w",
57 .comment =
"Clear input line"},
59 .name =
"kb-move-front",
60 .binding =
"Control+a",
61 .comment =
"Beginning of line"},
63 .name =
"kb-move-end",
64 .binding =
"Control+e",
65 .comment =
"End of line"},
67 .name =
"kb-move-word-back",
68 .binding =
"Alt+b,Control+Left",
69 .comment =
"Move back one word"},
71 .name =
"kb-move-word-forward",
72 .binding =
"Alt+f,Control+Right",
73 .comment =
"Move forward one word"},
75 .name =
"kb-move-char-back",
76 .binding =
"Left,Control+b",
77 .comment =
"Move back one char"},
79 .name =
"kb-move-char-forward",
80 .binding =
"Right,Control+f",
81 .comment =
"Move forward one char"},
83 .name =
"kb-remove-word-back",
84 .binding =
"Control+Alt+h,Control+BackSpace",
85 .comment =
"Delete previous word"},
87 .name =
"kb-remove-word-forward",
88 .binding =
"Control+Alt+d",
89 .comment =
"Delete next word"},
91 .name =
"kb-remove-char-forward",
92 .binding =
"Delete,Control+d",
93 .comment =
"Delete next char"},
95 .name =
"kb-remove-char-back",
96 .binding =
"BackSpace,Shift+BackSpace,Control+h",
97 .comment =
"Delete previous char"},
99 .name =
"kb-remove-to-eol",
100 .binding =
"Control+k",
101 .comment =
"Delete till the end of line"},
103 .name =
"kb-remove-to-sol",
104 .binding =
"Control+u",
105 .comment =
"Delete till the start of line"},
107 .name =
"kb-accept-entry",
108 .binding =
"Control+j,Control+m,Return,KP_Enter",
109 .comment =
"Accept entry"},
111 .name =
"kb-accept-custom",
112 .binding =
"Control+Return",
113 .comment =
"Use entered text as command (in ssh/run modes)"},
115 .name =
"kb-accept-custom-alt",
116 .binding =
"Control+Shift+Return",
117 .comment =
"Use entered text as command (in ssh/run modes)"},
119 .name =
"kb-accept-alt",
120 .binding =
"Shift+Return",
121 .comment =
"Use alternate accept command."},
123 .name =
"kb-delete-entry",
124 .binding =
"Shift+Delete",
125 .comment =
"Delete entry from history"},
127 .name =
"kb-mode-next",
128 .binding =
"Shift+Right,Control+Tab",
129 .comment =
"Switch to the next mode."},
131 .name =
"kb-mode-previous",
132 .binding =
"Shift+Left,Control+ISO_Left_Tab",
133 .comment =
"Switch to the previous mode."},
135 .name =
"kb-mode-complete",
136 .binding =
"Control+l",
137 .comment =
"Start completion for mode."},
139 .name =
"kb-row-left",
140 .binding =
"Control+Page_Up",
141 .comment =
"Go to the previous column"},
143 .name =
"kb-row-right",
144 .binding =
"Control+Page_Down",
145 .comment =
"Go to the next column"},
148 .binding =
"Up,Control+p",
149 .comment =
"Select previous entry"},
151 .name =
"kb-row-down",
152 .binding =
"Down,Control+n",
153 .comment =
"Select next entry"},
155 .name =
"kb-row-tab",
158 "Go to next row, if one left, accept it, if no left next mode."},
160 .name =
"kb-element-next",
162 .comment =
"Go to next element (in logical order)."},
164 .name =
"kb-element-prev",
165 .binding =
"ISO_Left_Tab",
166 .comment =
"Go to next previous element (in logical order)."},
168 .name =
"kb-page-prev",
169 .binding =
"Page_Up",
170 .comment =
"Go to the previous page"},
172 .name =
"kb-page-next",
173 .binding =
"Page_Down",
174 .comment =
"Go to the next page"},
176 .name =
"kb-row-first",
177 .binding =
"Home,KP_Home",
178 .comment =
"Go to the first entry"},
180 .name =
"kb-row-last",
181 .binding =
"End,KP_End",
182 .comment =
"Go to the last entry"},
184 .name =
"kb-row-select",
185 .binding =
"Control+space",
186 .comment =
"Set selected item as input text"},
188 .name =
"kb-screenshot",
190 .comment =
"Take a screenshot of the rofi window"},
192 .name =
"kb-ellipsize",
193 .binding =
"Alt+period",
194 .comment =
"Toggle between ellipsize modes for displayed data"},
196 .name =
"kb-toggle-case-sensitivity",
197 .binding =
"grave,dead_grave",
198 .comment =
"Toggle case sensitivity"},
200 .name =
"kb-toggle-sort",
201 .binding =
"Alt+grave",
202 .comment =
"Toggle sort"},
205 .binding =
"Escape,Control+g,Control+bracketleft",
206 .comment =
"Quit rofi"},
208 .name =
"kb-custom-1",
210 .comment =
"Custom keybinding 1"},
212 .name =
"kb-custom-2",
214 .comment =
"Custom keybinding 2"},
216 .name =
"kb-custom-3",
218 .comment =
"Custom keybinding 3"},
220 .name =
"kb-custom-4",
222 .comment =
"Custom keybinding 4"},
224 .name =
"kb-custom-5",
226 .comment =
"Custom Keybinding 5"},
228 .name =
"kb-custom-6",
230 .comment =
"Custom keybinding 6"},
232 .name =
"kb-custom-7",
234 .comment =
"Custom Keybinding 7"},
236 .name =
"kb-custom-8",
238 .comment =
"Custom keybinding 8"},
240 .name =
"kb-custom-9",
242 .comment =
"Custom keybinding 9"},
244 .name =
"kb-custom-10",
246 .comment =
"Custom keybinding 10"},
248 .name =
"kb-custom-11",
249 .binding =
"Alt+exclam",
250 .comment =
"Custom keybinding 11"},
252 .name =
"kb-custom-12",
254 .comment =
"Custom keybinding 12"},
256 .name =
"kb-custom-13",
257 .binding =
"Alt+numbersign",
258 .comment =
"Custom keybinding 13"},
260 .name =
"kb-custom-14",
261 .binding =
"Alt+dollar",
262 .comment =
"Custom keybinding 14"},
264 .name =
"kb-custom-15",
265 .binding =
"Alt+percent",
266 .comment =
"Custom keybinding 15"},
268 .name =
"kb-custom-16",
269 .binding =
"Alt+dead_circumflex",
270 .comment =
"Custom keybinding 16"},
272 .name =
"kb-custom-17",
273 .binding =
"Alt+ampersand",
274 .comment =
"Custom keybinding 17"},
276 .name =
"kb-custom-18",
277 .binding =
"Alt+asterisk",
278 .comment =
"Custom keybinding 18"},
280 .name =
"kb-custom-19",
281 .binding =
"Alt+parenleft",
282 .comment =
"Custom Keybinding 19"},
284 .name =
"kb-select-1",
285 .binding =
"Super+1",
286 .comment =
"Select row 1"},
288 .name =
"kb-select-2",
289 .binding =
"Super+2",
290 .comment =
"Select row 2"},
292 .name =
"kb-select-3",
293 .binding =
"Super+3",
294 .comment =
"Select row 3"},
296 .name =
"kb-select-4",
297 .binding =
"Super+4",
298 .comment =
"Select row 4"},
300 .name =
"kb-select-5",
301 .binding =
"Super+5",
302 .comment =
"Select row 5"},
304 .name =
"kb-select-6",
305 .binding =
"Super+6",
306 .comment =
"Select row 6"},
308 .name =
"kb-select-7",
309 .binding =
"Super+7",
310 .comment =
"Select row 7"},
312 .name =
"kb-select-8",
313 .binding =
"Super+8",
314 .comment =
"Select row 8"},
316 .name =
"kb-select-9",
317 .binding =
"Super+9",
318 .comment =
"Select row 9"},
320 .name =
"kb-select-10",
321 .binding =
"Super+0",
322 .comment =
"Select row 10"},
328 .name =
"ml-row-left",
329 .binding =
"ScrollLeft",
330 .comment =
"Go to the previous column"},
333 .name =
"ml-row-right",
334 .binding =
"ScrollRight",
335 .comment =
"Go to the next column"},
339 .binding =
"ScrollUp",
340 .comment =
"Select previous entry"},
343 .name =
"ml-row-down",
344 .binding =
"ScrollDown",
345 .comment =
"Select next entry"},
349 .name =
"me-select-entry",
350 .binding =
"MousePrimary",
351 .comment =
"Select hovered row"},
354 .name =
"me-accept-entry",
355 .binding =
"MouseDPrimary",
356 .comment =
"Accept hovered row"},
359 .name =
"me-accept-custom",
360 .binding =
"Control+MouseDPrimary",
361 .comment =
"Accept hovered row with custom action"},
382 G_GNUC_UNUSED gpointer target,
383 gpointer user_data) {
385 GPOINTER_TO_UINT(user_data))
386 ? NK_BINDINGS_BINDING_TRIGGERED
387 : NK_BINDINGS_BINDING_NOT_TRIGGERED;
391 gpointer user_data) {
393 GPOINTER_TO_UINT(user_data));
399 if (g_strcmp0(b->
name, name) == 0) {
407 GError *error = NULL;
408 GString *error_msg = g_string_new(
"");
411 char *keystr = g_strdup(b->
binding);
415 const char *
const sep =
",";
416 for (
char *entry = strtok_r(keystr, sep, &sp); entry != NULL;
417 entry = strtok_r(NULL, sep, &sp)) {
420 GUINT_TO_POINTER(b->
id), NULL, &error)) {
421 char *str = g_markup_printf_escaped(
422 "Failed to set binding <i>%s</i> for: <i>%s (%s)</i>:\n\t<span "
423 "size=\"smaller\" style=\"italic\">%s</span>\n",
425 g_string_append(error_msg, str);
427 g_clear_error(&error);
433 if (error_msg->len > 0) {
444 GSIZE_TO_POINTER(j), NULL, NULL);
448 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)
@ 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[]