rofi 1.7.9
script.c
Go to the documentation of this file.
1/*
2 * rofi
3 *
4 * MIT/X11 License
5 * Copyright © 2013-2023 Qball Cow <qball@gmpclient.org>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 */
27
29#define G_LOG_DOMAIN "Modes.Script"
30
31#include "modes/script.h"
32#include "helper.h"
33#include "rofi.h"
34#include <assert.h>
35#include <ctype.h>
36#include <errno.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <string.h>
40#include <strings.h>
41#include <unistd.h>
42
43#include "widgets/textbox.h"
44
45#include "mode-private.h"
46
47#include "rofi-icon-fetcher.h"
48
50
51typedef struct {
53 unsigned int id;
57 unsigned int cmd_list_length;
58
61 unsigned int num_urgent_list;
64 unsigned int num_active_list;
66 char *message;
67 char *prompt;
68 char *data;
69 gboolean do_markup;
72 char delim;
74 gboolean no_custom;
76 gboolean keep_filter;
77
78 gboolean use_hot_keys;
80
84void dmenuscript_parse_entry_extras(G_GNUC_UNUSED Mode *sw,
85 DmenuScriptEntry *entry, char *buffer,
86 G_GNUC_UNUSED size_t length) {
87 gchar **extras = g_strsplit(buffer, "\x1f", -1);
88 gchar **extra = extras;
89 for (; *extra != NULL && *(extra + 1) != NULL; extra += 2) {
90 gchar *key = *extra;
91 gchar *value = *(extra + 1);
92 // Mark NULL
93 *(extra) = NULL;
94 *(extra + 1) = NULL;
95 if (strcasecmp(key, "icon") == 0) {
96 entry->icon_name = value;
97 } else if (strcasecmp(key, "display") == 0) {
98 entry->display = value;
99 } else if (strcasecmp(key, "meta") == 0) {
100 entry->meta = value;
101 } else if (strcasecmp(key, "info") == 0) {
102 entry->info = value;
103 } else if (strcasecmp(key, "nonselectable") == 0) {
104 entry->nonselectable = g_ascii_strcasecmp(value, "true") == 0;
105 g_free(value);
106 } else if (strcasecmp(key, "permanent") == 0) {
107 entry->permanent = g_ascii_strcasecmp(value, "true") == 0;
108 g_free(value);
109 } else if (strcasecmp(key, "urgent") == 0) {
110 entry->urgent = g_ascii_strcasecmp(value, "true") == 0;
111 g_free(value);
112 } else if (strcasecmp(key, "active") == 0) {
113 entry->active = g_ascii_strcasecmp(value, "true") == 0;
114 g_free(value);
115 } else {
116 g_free(value);
117 }
118 g_free(key);
119 }
120 // Got an extra entry.. lets free it.
121 if (*extras != NULL) {
122 g_free(*extras);
123 }
124 g_free(extras);
125}
126
130
131static void parse_header_entry(Mode *sw, char *line, ssize_t length) {
133 ssize_t length_key = 0; // strlen ( line );
134 while (length_key < length && line[length_key] != '\x1f') {
135 length_key++;
136 }
137
138 if ((length_key + 1) < length) {
139 line[length_key] = '\0';
140 char *value = line + length_key + 1;
141 if (strcasecmp(line, "message") == 0) {
142 g_free(pd->message);
143 pd->message = strlen(value) ? g_strdup(value) : NULL;
144 } else if (strcasecmp(line, "prompt") == 0) {
145 g_free(pd->prompt);
146 pd->prompt = g_strdup(value);
147 sw->display_name = pd->prompt;
148 } else if (strcasecmp(line, "markup-rows") == 0) {
149 pd->do_markup = (strcasecmp(value, "true") == 0);
150 } else if (strcasecmp(line, "urgent") == 0) {
151 parse_ranges(value, &(pd->urgent_list), &(pd->num_urgent_list));
152 } else if (strcasecmp(line, "active") == 0) {
153 parse_ranges(value, &(pd->active_list), &(pd->num_active_list));
154 } else if (strcasecmp(line, "delim") == 0) {
155 pd->delim = helper_parse_char(value);
156 } else if (strcasecmp(line, "no-custom") == 0) {
157 pd->no_custom = (strcasecmp(value, "true") == 0);
158 } else if (strcasecmp(line, "use-hot-keys") == 0) {
159 pd->use_hot_keys = (strcasecmp(value, "true") == 0);
160 } else if (strcasecmp(line, "keep-selection") == 0) {
161 pd->keep_selection = (strcasecmp(value, "true") == 0);
162 } else if (strcasecmp(line, "keep-filter") == 0) {
163 pd->keep_filter = (strcasecmp(value, "true") == 0);
164 } else if (strcasecmp(line, "new-selection") == 0) {
165 pd->new_selection = (int64_t)g_ascii_strtoll(value, NULL, 0);
166 } else if (strcasecmp(line, "data") == 0) {
167 g_free(pd->data);
168 pd->data = g_strdup(value);
169 } else if (strcasecmp(line, "theme") == 0) {
170 if (rofi_theme_parse_string((const char *)value)) {
171 g_warning("Failed to parse: '%s'", value);
173 }
174 }
175 }
176}
177
179 unsigned int *length, int value,
180 DmenuScriptEntry *entry) {
182 int fd = -1;
183 GError *error = NULL;
184 DmenuScriptEntry *retv = NULL;
185 char **argv = NULL;
186 int argc = 0;
187 *length = 0;
188 // Reset these between runs.
189 pd->new_selection = -1;
190 pd->keep_selection = 0;
191 pd->keep_filter = 0;
192 // Environment
193 char **env = g_get_environ();
194
195 char *str_value = g_strdup_printf("%d", value);
196 env = g_environ_setenv(env, "ROFI_RETV", str_value, TRUE);
197 g_free(str_value);
198
199 str_value = g_strdup_printf("%d", (int)getpid());
200 env = g_environ_setenv(env, "ROFI_OUTSIDE", str_value, TRUE);
201 g_free(str_value);
202
203 if (entry && entry->info) {
204 env = g_environ_setenv(env, "ROFI_INFO", entry->info, TRUE);
205 }
206 if (pd->data) {
207 env = g_environ_setenv(env, "ROFI_DATA", pd->data, TRUE);
208 }
209
210 if (g_shell_parse_argv(sw->ed, &argc, &argv, &error)) {
211 argv = g_realloc(argv, (argc + 2) * sizeof(char *));
212 argv[argc] = g_strdup(arg);
213 argv[argc + 1] = NULL;
214 g_spawn_async_with_pipes(NULL, argv, env, G_SPAWN_SEARCH_PATH, NULL, NULL,
215 NULL, NULL, &fd, NULL, &error);
216 }
217 g_strfreev(env);
218 if (error != NULL) {
219 char *msg = g_strdup_printf("Failed to execute: '%s'\nError: '%s'",
220 (char *)sw->ed, error->message);
221 rofi_view_error_dialog(msg, FALSE);
222 g_free(msg);
223 // print error.
224 g_error_free(error);
225 fd = -1;
226 }
227 if (fd >= 0) {
228 FILE *inp = fdopen(fd, "r");
229 if (inp) {
230 char *buffer = NULL;
231 size_t buffer_length = 0;
232 ssize_t read_length = 0;
233 size_t actual_size = 0;
234 while ((read_length = getdelim(&buffer, &buffer_length, pd->delim, inp)) >
235 0) {
236 // Filter out line-end.
237 if (buffer[read_length - 1] == pd->delim) {
238 buffer[read_length - 1] = '\0';
239 }
240 if (buffer[0] == '\0') {
241 parse_header_entry(sw, &buffer[1], read_length - 1);
242 } else {
243 if (actual_size < ((*length) + 2)) {
244 actual_size += 256;
245 retv = g_realloc(retv, (actual_size) * sizeof(DmenuScriptEntry));
246 }
247 if (retv) {
248 size_t buf_length = strlen(buffer) + 1;
249#if GLIB_CHECK_VERSION(2, 68, 0)
250 retv[(*length)].entry = g_memdup2(buffer, buf_length);
251#else
252 retv[(*length)].entry = g_memdup(buffer, buf_length);
253#endif
254 retv[(*length)].icon_name = NULL;
255 retv[(*length)].display = NULL;
256 retv[(*length)].meta = NULL;
257 retv[(*length)].info = NULL;
258 retv[(*length)].active = FALSE;
259 retv[(*length)].urgent = FALSE;
260 retv[(*length)].icon_fetch_uid = 0;
261 retv[(*length)].icon_fetch_size = 0;
262 retv[(*length)].nonselectable = FALSE;
263 retv[(*length)].permanent = FALSE;
264 if (buf_length > 0 && (read_length > (ssize_t)buf_length)) {
265 dmenuscript_parse_entry_extras(sw, &(retv[(*length)]),
266 buffer + buf_length,
267 read_length - buf_length);
268 }
269 memset(&(retv[(*length) + 1]), 0, sizeof(DmenuScriptEntry));
270 (*length)++;
271 }
272 }
273 }
274 if (buffer) {
275 free(buffer);
276 }
277 if (fclose(inp) != 0) {
278 g_warning("Failed to close stdout off executor script: '%s'",
279 g_strerror(errno));
280 }
281 }
282 }
283 g_strfreev(argv);
284 return retv;
285}
286
287static void script_switcher_free(Mode *sw) {
288 if (sw == NULL) {
289 return;
290 }
291 g_free(sw->name);
292 g_free(sw->ed);
293 g_free(sw);
294}
295
296static int script_mode_init(Mode *sw) {
297 if (sw->private_data == NULL) {
298 ScriptModePrivateData *pd = g_malloc0(sizeof(*pd));
299 pd->delim = '\n';
300 sw->private_data = (void *)pd;
301 pd->cmd_list = execute_executor(sw, NULL, &(pd->cmd_list_length), 0, NULL);
302 }
303 return TRUE;
304}
305static unsigned int script_mode_get_num_entries(const Mode *sw) {
306 const ScriptModePrivateData *rmpd =
308 return rmpd->cmd_list_length;
309}
310
313
314 rmpd->num_urgent_list = 0;
315 g_free(rmpd->urgent_list);
316 rmpd->urgent_list = NULL;
317 rmpd->num_active_list = 0;
318 g_free(rmpd->active_list);
319 rmpd->active_list = NULL;
320}
321
322static ModeMode script_mode_result(Mode *sw, int mretv, char **input,
323 unsigned int selected_line) {
325 ModeMode retv = MODE_EXIT;
326 DmenuScriptEntry *new_list = NULL;
327 unsigned int new_length = 0;
328 // store them as they might be different on next executor and reset.
329 gboolean keep_filter = rmpd->keep_filter;
330 gboolean keep_selection = rmpd->keep_selection;
331
332 if ((mretv & MENU_CUSTOM_COMMAND)) {
333 if (rmpd->use_hot_keys) {
335 if (selected_line != UINT32_MAX) {
336 new_list = execute_executor(sw, rmpd->cmd_list[selected_line].entry,
337 &new_length, 10 + (mretv & MENU_LOWER_MASK),
338 &(rmpd->cmd_list[selected_line]));
339 } else {
340 if (rmpd->no_custom == FALSE) {
341 new_list = execute_executor(sw, *input, &new_length,
342 10 + (mretv & MENU_LOWER_MASK), NULL);
343 } else {
344 return RELOAD_DIALOG;
345 }
346 }
347 } else {
348 retv = (mretv & MENU_LOWER_MASK);
349 return retv;
350 }
351 } else if ((mretv & MENU_ENTRY_DELETE) && selected_line != UINT32_MAX) {
353 new_list = execute_executor(sw, rmpd->cmd_list[selected_line].entry, &new_length,
354 3, &(rmpd->cmd_list[selected_line]));
355 } else if ((mretv & MENU_OK) && rmpd->cmd_list[selected_line].entry != NULL) {
356 if (rmpd->cmd_list[selected_line].nonselectable) {
357 return RELOAD_DIALOG;
358 }
360 new_list =
361 execute_executor(sw, rmpd->cmd_list[selected_line].entry, &new_length,
362 1, &(rmpd->cmd_list[selected_line]));
363 } else if ((mretv & MENU_CUSTOM_INPUT) && *input != NULL) {
364 if (rmpd->no_custom == FALSE) {
366 new_list = execute_executor(sw, *input, &new_length, 2, NULL);
367 } else {
368 return RELOAD_DIALOG;
369 }
370 }
371
372 // If a new list was generated, use that an loop around.
373 if (new_list != NULL) {
374 for (unsigned int i = 0; i < rmpd->cmd_list_length; i++) {
375 g_free(rmpd->cmd_list[i].entry);
376 g_free(rmpd->cmd_list[i].icon_name);
377 g_free(rmpd->cmd_list[i].display);
378 g_free(rmpd->cmd_list[i].meta);
379 g_free(rmpd->cmd_list[i].info);
380 }
381 g_free(rmpd->cmd_list);
382
383 rmpd->cmd_list = new_list;
384 rmpd->cmd_list_length = new_length;
385 if (keep_selection) {
386 if (rmpd->new_selection >= 0 &&
387 rmpd->new_selection < rmpd->cmd_list_length) {
389 rmpd->new_selection);
390 } else {
392 }
393 } else {
395 }
396 if (keep_filter == FALSE) {
397 g_free(*input);
398 *input = NULL;
399 }
400 retv = RELOAD_DIALOG;
401 }
402 return retv;
403}
404
405static void script_mode_destroy(Mode *sw) {
407 if (rmpd != NULL) {
408 for (unsigned int i = 0; i < rmpd->cmd_list_length; i++) {
409 g_free(rmpd->cmd_list[i].entry);
410 g_free(rmpd->cmd_list[i].icon_name);
411 g_free(rmpd->cmd_list[i].display);
412 g_free(rmpd->cmd_list[i].meta);
413 }
414 g_free(rmpd->cmd_list);
415 g_free(rmpd->message);
416 g_free(rmpd->prompt);
417 g_free(rmpd->data);
418 g_free(rmpd->urgent_list);
419 g_free(rmpd->active_list);
420 g_free(rmpd);
421 sw->private_data = NULL;
422 }
423}
424static inline unsigned int get_index(unsigned int length, int index) {
425 if (index >= 0) {
426 return index;
427 }
428 if (((unsigned int)-index) <= length) {
429 return length + index;
430 }
431 // Out of range.
432 return UINT_MAX;
433}
434static char *_get_display_value(const Mode *sw, unsigned int selected_line,
435 G_GNUC_UNUSED int *state,
436 G_GNUC_UNUSED GList **list, int get_entry) {
438 for (unsigned int i = 0; i < pd->num_active_list; i++) {
439 unsigned int start =
441 unsigned int stop = get_index(pd->cmd_list_length, pd->active_list[i].stop);
442 if (selected_line >= start && selected_line <= stop) {
443 *state |= ACTIVE;
444 }
445 }
446 for (unsigned int i = 0; i < pd->num_urgent_list; i++) {
447 unsigned int start =
449 unsigned int stop = get_index(pd->cmd_list_length, pd->urgent_list[i].stop);
450 if (selected_line >= start && selected_line <= stop) {
451 *state |= URGENT;
452 }
453 }
454 if (pd->cmd_list[selected_line].urgent) {
455 *state |= URGENT;
456 }
457 if (pd->cmd_list[selected_line].active) {
458 *state |= ACTIVE;
459 }
460 if (pd->do_markup) {
461 *state |= MARKUP;
462 }
463 if (pd->cmd_list[selected_line].display) {
464 return get_entry ? g_strdup(pd->cmd_list[selected_line].display) : NULL;
465 } else {
466 return get_entry ? g_strdup(pd->cmd_list[selected_line].entry) : NULL;
467 }
468}
469
470static int script_token_match(const Mode *sw, rofi_int_matcher **tokens,
471 unsigned int index) {
474 char *esc = NULL;
475
476 if (rmpd->cmd_list[index].permanent == TRUE) {
477 // Always match
478 return 1;
479 }
480
481 if (rmpd->do_markup) {
482 pango_parse_markup(rmpd->cmd_list[index].entry, -1, 0, NULL, &esc, NULL,
483 NULL);
484 } else {
485 esc = rmpd->cmd_list[index].entry;
486 }
487 if (esc) {
488 int match = 1;
489 if (tokens) {
490 for (int j = 0; match && tokens[j] != NULL; j++) {
491 rofi_int_matcher *ftokens[2] = {tokens[j], NULL};
492 int test = 0;
493 test = helper_token_match(ftokens, esc);
494 if (test == tokens[j]->invert && rmpd->cmd_list[index].meta) {
495 test = helper_token_match(ftokens, rmpd->cmd_list[index].meta);
496 }
497
498 if (test == 0) {
499 match = 0;
500 }
501 }
502 }
503 if (rmpd->do_markup) {
504 g_free(esc);
505 }
506 return match;
507 }
508 return FALSE;
509}
510static char *script_get_message(const Mode *sw) {
512 return g_strdup(pd->message);
513}
514static cairo_surface_t *script_get_icon(const Mode *sw,
515 unsigned int selected_line,
516 unsigned int height) {
519 g_return_val_if_fail(pd->cmd_list != NULL, NULL);
520 DmenuScriptEntry *dr = &(pd->cmd_list[selected_line]);
521 if (dr->icon_name == NULL) {
522 return NULL;
523 }
524 if (dr->icon_fetch_uid > 0 && dr->icon_fetch_size == height) {
526 }
528 dr->icon_fetch_size = height;
530}
531
532#include "mode-private.h"
533
537typedef struct ScriptUser {
539 char *name;
541 char *path;
543
547size_t num_scripts = 0;
548
550 for (size_t i = 0; i < num_scripts; i++) {
551 g_free(user_scripts[i].name);
552 g_free(user_scripts[i].path);
553 }
554 g_free(user_scripts);
555}
557 const char *cpath = g_get_user_config_dir();
558 char *script_dir = g_build_filename(cpath, "rofi", "scripts", NULL);
559 if (g_file_test(script_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ==
560 FALSE) {
561 g_free(script_dir);
562 return;
563 }
564 GDir *sd = g_dir_open(script_dir, 0, NULL);
565 if (sd) {
566 const char *file = NULL;
567 while ((file = g_dir_read_name(sd)) != NULL) {
568 char *sp = g_build_filename(cpath, "rofi", "scripts", file, NULL);
570 g_realloc(user_scripts, sizeof(ScriptUser) * (num_scripts + 1));
571 user_scripts[num_scripts].path = sp;
572 user_scripts[num_scripts].name = g_strdup(file);
573 char *dot = strrchr(user_scripts[num_scripts].name, '.');
574 if (dot) {
575 *dot = '\0';
576 }
577 num_scripts++;
578 }
579 g_dir_close(sd);
580 }
581
582 g_free(script_dir);
583}
584
585static int script_mode_has_user_script(char const *const user) {
586
587 for (size_t i = 0; i < num_scripts; i++) {
588 if (g_strcmp0(user_scripts[i].name, user) == 0) {
589 return i;
590 }
591 }
592 return -1;
593}
594
595Mode *script_mode_parse_setup(const char *str) {
596 int ui = 0;
597 if ((ui = script_mode_has_user_script(str)) >= 0) {
598 Mode *sw = g_malloc0(sizeof(*sw));
599 sw->name = g_strdup(user_scripts[ui].name);
600 sw->ed = g_strdup(user_scripts[ui].path);
609 sw->_get_completion = NULL, sw->_preprocess_input = NULL,
612 return sw;
613 }
614 Mode *sw = g_malloc0(sizeof(*sw));
615 unsigned int index = 0;
616 const char *const sep = ":";
617 char **tokens = g_strsplit(str, sep, 2);
618 if (tokens) {
619 index = g_strv_length(tokens);
620 sw->name = g_strdup(tokens[0]);
621 sw->ed = (void *)rofi_expand_path(tokens[1]);
622 g_strfreev(tokens);
623 }
624 if (index == 2) {
633 sw->_get_completion = NULL, sw->_preprocess_input = NULL,
636
637 return sw;
638 }
639 fprintf(
640 stderr,
641 "The script command '%s' has %u options, but needs 2: <name>:<script>.",
642 str, index);
644 return NULL;
645}
646
647gboolean script_mode_is_valid(const char *token) {
648 if (script_mode_has_user_script(token) >= 0) {
649 return TRUE;
650 }
651 return strchr(token, ':') != NULL;
652}
653
654void script_user_list(gboolean is_term) {
655
656 for (unsigned int i = 0; i < num_scripts; i++) {
657 printf(" • %s%s%s (%s)\n", is_term ? (color_bold) : "",
658 user_scripts[i].name, is_term ? color_reset : "",
659 user_scripts[i].path);
660 }
661}
static char * _get_display_value(const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **attr_list, int get_entry)
void parse_ranges(char *input, rofi_range_pair **list, unsigned int *length)
Definition helper.c:1276
char helper_parse_char(const char *arg)
Definition helper.c:384
char * rofi_expand_path(const char *input)
Definition helper.c:781
int helper_token_match(rofi_int_matcher *const *tokens, const char *input)
Definition helper.c:542
cairo_surface_t * rofi_icon_fetcher_get(const uint32_t uid)
uint32_t rofi_icon_fetcher_query(const char *name, const int size)
struct rofi_mode Mode
Definition mode.h:49
void * mode_get_private_data(const Mode *mode)
Definition mode.c:176
ModeMode
Definition mode.h:54
@ MENU_CUSTOM_COMMAND
Definition mode.h:84
@ MENU_LOWER_MASK
Definition mode.h:92
@ MENU_ENTRY_DELETE
Definition mode.h:80
@ MENU_OK
Definition mode.h:72
@ MENU_CUSTOM_INPUT
Definition mode.h:78
@ MODE_EXIT
Definition mode.h:56
@ RELOAD_DIALOG
Definition mode.h:60
#define color_reset
Definition rofi.h:115
#define color_bold
Definition rofi.h:117
void rofi_clear_error_messages(void)
Definition rofi.c:94
void script_mode_gather_user_scripts(void)
Definition script.c:556
gboolean script_mode_is_valid(const char *token)
Definition script.c:647
void script_user_list(gboolean is_term)
Definition script.c:654
void script_mode_cleanup(void)
Definition script.c:549
Mode * script_mode_parse_setup(const char *str)
Definition script.c:595
@ URGENT
Definition textbox.h:108
@ ACTIVE
Definition textbox.h:110
@ MARKUP
Definition textbox.h:114
int rofi_view_error_dialog(const char *msg, int markup)
Definition view.c:2675
RofiViewState * rofi_view_get_active(void)
Definition view.c:623
void rofi_view_set_selected_line(RofiViewState *state, unsigned int selected_line)
Definition view.c:655
@ MODE_TYPE_SWITCHER
struct rofi_int_matcher_t rofi_int_matcher
static void script_mode_destroy(Mode *sw)
Definition script.c:405
static void script_switcher_free(Mode *sw)
Definition script.c:287
static void parse_header_entry(Mode *sw, char *line, ssize_t length)
Definition script.c:131
static ModeMode script_mode_result(Mode *sw, int mretv, char **input, unsigned int selected_line)
Definition script.c:322
static cairo_surface_t * script_get_icon(const Mode *sw, unsigned int selected_line, unsigned int height)
Definition script.c:514
void dmenuscript_parse_entry_extras(G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *entry, char *buffer, G_GNUC_UNUSED size_t length)
Definition script.c:84
static unsigned int get_index(unsigned int length, int index)
Definition script.c:424
static char * script_get_message(const Mode *sw)
Definition script.c:510
ScriptUser * user_scripts
Definition script.c:545
static int script_mode_has_user_script(char const *const user)
Definition script.c:585
size_t num_scripts
Definition script.c:547
static void script_mode_reset_highlight(Mode *sw)
Definition script.c:311
static char * _get_display_value(const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **list, int get_entry)
Definition script.c:434
static int script_mode_init(Mode *sw)
Definition script.c:296
static DmenuScriptEntry * execute_executor(Mode *sw, char *arg, unsigned int *length, int value, DmenuScriptEntry *entry)
Definition script.c:178
static int script_token_match(const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
Definition script.c:470
static unsigned int script_mode_get_num_entries(const Mode *sw)
Definition script.c:305
struct rofi_range_pair * urgent_list
Definition script.c:60
gboolean no_custom
Definition script.c:74
struct rofi_range_pair * active_list
Definition script.c:63
gboolean use_hot_keys
Definition script.c:78
gboolean do_markup
Definition script.c:69
unsigned int num_urgent_list
Definition script.c:61
int64_t new_selection
Definition script.c:71
unsigned int id
Definition script.c:53
unsigned int cmd_list_length
Definition script.c:57
gboolean keep_filter
Definition script.c:76
unsigned int num_active_list
Definition script.c:64
DmenuScriptEntry * cmd_list
Definition script.c:55
gboolean keep_selection
Definition script.c:70
char * name
Definition script.c:539
char * path
Definition script.c:541
_mode_result _result
__mode_get_num_entries _get_num_entries
__mode_destroy _destroy
_mode_preprocess_input _preprocess_input
char * display_name
_mode_free free
_mode_token_match _token_match
_mode_get_display_value _get_display_value
_mode_get_icon _get_icon
_mode_get_completion _get_completion
__mode_init _init
ModeType type
char * name
_mode_get_message _get_message
void * private_data
gboolean rofi_theme_parse_string(const char *string)