rofi 2.1.2
filebrowser.c
Go to the documentation of this file.
1
26#include "config.h"
27#include <errno.h>
28#include <gio/gio.h>
29#include <gmodule.h>
30#include <stdio.h>
31#include <stdlib.h>
32#include <string.h>
33#include <unistd.h>
34
35#include <dirent.h>
36#include <glib/gstdio.h>
37#include <sys/stat.h>
38#include <sys/types.h>
39
40#include "display.h"
41#include "helper.h"
42#include "history.h"
43#include "mode-private.h"
44#include "mode.h"
45#include "modes/filebrowser.h"
46#include "rofi.h"
47#include "theme.h"
48
49#include <stdint.h>
50
51#include "rofi-icon-fetcher.h"
52
53#define FILEBROWSER_CACHE_FILE "rofi3.filebrowsercache"
55#define DEFAULT_OPEN "xdg-open"
56
57#if defined(__APPLE__)
58#define st_atim st_atimespec
59#define st_ctim st_ctimespec
60#define st_mtim st_mtimespec
61#endif
62
72
80
89
91const char *icon_name[NUM_FILE_TYPES] = {"go-up", "folder", "gtk-file"};
92typedef struct {
93 char *name;
94 char *path;
99 gboolean link;
101 time_t time;
103} FBFile;
104
105typedef struct {
106 char *command;
109 unsigned int array_length;
110 unsigned int array_length_real;
112
116struct {
122 gboolean directories_first;
124 gboolean show_hidden;
126 .sorting_method = FB_SORT_NAME,
127 .sorting_time = FB_MTIME,
128 .directories_first = TRUE,
129 .show_hidden = FALSE,
131
133 for (unsigned int i = 0; i < pd->array_length; i++) {
134 FBFile *fb = &(pd->array[i]);
135 g_free(fb->name);
136 g_free(fb->path);
137 g_free(fb->collate_key);
138 }
139 g_free(pd->array);
140 pd->array = NULL;
141 pd->array_length = 0;
142 pd->array_length_real = 0;
143}
144#include <dirent.h>
145#include <sys/types.h>
146
147static gint compare_name(gconstpointer a, gconstpointer b,
148 G_GNUC_UNUSED gpointer data) {
149 FBFile *fa = (FBFile *)a;
150 FBFile *fb = (FBFile *)b;
151
152 if (file_browser_config.directories_first && fa->type != fb->type) {
153 return fa->type - fb->type;
154 }
155
156 return g_strcmp0(fa->collate_key, fb->collate_key);
157}
158
159static gint compare_time(gconstpointer a, gconstpointer b,
160 G_GNUC_UNUSED gpointer data) {
161 FBFile *fa = (FBFile *)a;
162 FBFile *fb = (FBFile *)b;
163
164 if (file_browser_config.directories_first && fa->type != fb->type) {
165 return fa->type - fb->type;
166 }
167
168 if (fa->time < 0) {
169 return -1;
170 }
171
172 if (fb->time < 0) {
173 return 1;
174 }
175
176 return fb->time - fa->time;
177}
178
179static gint compare(gconstpointer a, gconstpointer b, gpointer data) {
180 GCompareDataFunc comparator = NULL;
181
182 switch (file_browser_config.sorting_method) {
183 case FB_SORT_NAME:
184 comparator = compare_name;
185 break;
186 case FB_SORT_TIME:
187 comparator = compare_time;
188 break;
189 default:
190 comparator = compare_name;
191 break;
192 }
193
194 return comparator(a, b, data);
195}
196
197static time_t get_time(const GStatBuf *statbuf) {
198 switch (file_browser_config.sorting_time) {
199 case FB_MTIME:
200 return statbuf->st_mtim.tv_sec;
201 case FB_ATIME:
202 return statbuf->st_atim.tv_sec;
203 case FB_CTIME:
204 return statbuf->st_ctim.tv_sec;
205 default:
206 return 0;
207 }
208}
209
210static void set_time(FBFile *file) {
211 // GError *error = NULL;
212 // gchar *path = g_filename_from_utf8(file->path, -1, NULL, NULL, &error);
213 // if (error) {
214 // g_warning("Failed to convert filename: %s: %s", file->path,
215 // error->message); g_error_free(error); return;
216 // }
217
218 GStatBuf statbuf;
219
220 if (g_lstat(file->path, &statbuf) == 0) {
221 file->time = get_time(&statbuf);
222 } else {
223 g_warning("Failed to stat file: %s, %s", file->path, strerror(errno));
224 }
225
226 // g_free(path);
227}
228
229static void set_collate_key(FBFile *file) {
230 file->collate_key = g_utf8_collate_key_for_filename(file->name, -1);
231}
232
234 if ((pd->array_length + 1) > pd->array_length_real) {
235 pd->array_length_real += 256;
236 pd->array =
237 g_realloc(pd->array, (pd->array_length_real + 1) * sizeof(FBFile));
238 }
239}
240
241static void get_file_browser(Mode *sw) {
248 char *cdir = g_file_get_path(pd->current_dir);
249 DIR *dir = opendir(cdir);
250 if (dir) {
251 struct dirent *rd = NULL;
252 while ((rd = readdir(dir)) != NULL) {
253 if (g_strcmp0(rd->d_name, "..") == 0) {
254 fb_resize_array(pd);
255 // Rofi expects utf-8, so lets convert the filename.
256 pd->array[pd->array_length].name = g_strdup("..");
257 pd->array[pd->array_length].path = NULL;
258 pd->array[pd->array_length].type = UP;
259 pd->array[pd->array_length].icon_fetch_uid = 0;
262 pd->array[pd->array_length].link = FALSE;
263 pd->array[pd->array_length].time = -1;
264 pd->array[pd->array_length].collate_key = NULL;
265 pd->array_length++;
266 continue;
267 }
268 if (g_strcmp0(rd->d_name, ".") == 0) {
269 continue;
270 }
271 if (rd->d_name[0] == '.' && file_browser_config.show_hidden == FALSE) {
272 continue;
273 }
274
275 switch (rd->d_type) {
276 case DT_BLK:
277 case DT_CHR:
278 case DT_FIFO:
279 case DT_UNKNOWN:
280 case DT_SOCK:
281 default:
282 break;
283 case DT_REG:
284 case DT_DIR:
285 fb_resize_array(pd);
286 // Rofi expects utf-8, so lets convert the filename.
287 pd->array[pd->array_length].name =
288 g_filename_to_utf8(rd->d_name, -1, NULL, NULL, NULL);
289 if (pd->array[pd->array_length].name == NULL) {
290 pd->array[pd->array_length].name = rofi_force_utf8(rd->d_name, -1);
291 }
292 pd->array[pd->array_length].path =
293 g_build_filename(cdir, rd->d_name, NULL);
294 pd->array[pd->array_length].type =
295 (rd->d_type == DT_DIR) ? DIRECTORY : RFILE;
296 pd->array[pd->array_length].icon_fetch_uid = 0;
299 pd->array[pd->array_length].link = FALSE;
300 pd->array[pd->array_length].collate_key = NULL;
301 pd->array[pd->array_length].time = -1;
302
303 if (file_browser_config.sorting_method == FB_SORT_NAME) {
305 } else if (file_browser_config.sorting_method == FB_SORT_TIME) {
306 set_time(&pd->array[pd->array_length]);
307 }
308
309 pd->array_length++;
310 break;
311 case DT_LNK:
312 fb_resize_array(pd);
313 // Rofi expects utf-8, so lets convert the filename.
314 pd->array[pd->array_length].name =
315 g_filename_to_utf8(rd->d_name, -1, NULL, NULL, NULL);
316 if (pd->array[pd->array_length].name == NULL) {
317 pd->array[pd->array_length].name = rofi_force_utf8(rd->d_name, -1);
318 }
319 pd->array[pd->array_length].path =
320 g_build_filename(cdir, rd->d_name, NULL);
321 pd->array[pd->array_length].icon_fetch_uid = 0;
324 pd->array[pd->array_length].collate_key = NULL;
325 pd->array[pd->array_length].link = TRUE;
326 // Default to file.
327 pd->array[pd->array_length].type = RFILE;
328
329 if (file_browser_config.sorting_method == FB_SORT_NAME) {
331 }
332
333 {
334 // If we have link, use a stat to fine out what it is, if we fail, we
335 // mark it as file.
336 // TODO have a 'broken link' mode?
337 // Convert full path to right encoding.
338 // DD: Path should be in file encoding, not utf-8
339 // char *file =
340 // g_filename_from_utf8(pd->array[pd->array_length].path,
341 // -1, NULL, NULL, NULL);
342 if (pd->array[pd->array_length].path) {
343 GStatBuf statbuf;
344 if (g_stat(pd->array[pd->array_length].path, &statbuf) == 0) {
345 if (S_ISDIR(statbuf.st_mode)) {
346 pd->array[pd->array_length].type = DIRECTORY;
347 } else if (S_ISREG(statbuf.st_mode)) {
348 pd->array[pd->array_length].type = RFILE;
349 }
350
351 if (file_browser_config.sorting_method == FB_SORT_TIME) {
352 pd->array[pd->array_length].time = get_time(&statbuf);
353 }
354 } else {
355 g_warning("Failed to stat file: %s, %s",
356 pd->array[pd->array_length].path, strerror(errno));
357 }
358
359 // g_free(file);
360 }
361 }
362 pd->array_length++;
363 break;
364 }
365 }
366 closedir(dir);
367 }
368 g_free(cdir);
369 g_qsort_with_data(pd->array, pd->array_length, sizeof(FBFile), compare, NULL);
370}
371
375 char *msg = NULL;
376 gboolean found_error = FALSE;
377
378 ThemeWidget *wid = rofi_config_find_widget(sw->name, NULL, TRUE);
379
380 Property *p = rofi_theme_find_property(wid, P_STRING, "sorting-method", TRUE);
381 if (p != NULL && p->type == P_STRING) {
382 if (g_strcmp0(p->value.s, "name") == 0) {
383 file_browser_config.sorting_method = FB_SORT_NAME;
384 } else if (g_strcmp0(p->value.s, "mtime") == 0) {
385 file_browser_config.sorting_method = FB_SORT_TIME;
386 file_browser_config.sorting_time = FB_MTIME;
387 } else if (g_strcmp0(p->value.s, "atime") == 0) {
388 file_browser_config.sorting_method = FB_SORT_TIME;
389 file_browser_config.sorting_time = FB_ATIME;
390 } else if (g_strcmp0(p->value.s, "ctime") == 0) {
391 file_browser_config.sorting_method = FB_SORT_TIME;
392 file_browser_config.sorting_time = FB_CTIME;
393 } else {
394 found_error = TRUE;
395
396 msg = g_strdup_printf("\"%s\" is not a valid filebrowser sorting method",
397 p->value.s);
398 }
399 }
400
401 p = rofi_theme_find_property(wid, P_BOOLEAN, "directories-first", TRUE);
402 if (p != NULL && p->type == P_BOOLEAN) {
403 file_browser_config.directories_first = p->value.b;
404 }
405
406 p = rofi_theme_find_property(wid, P_BOOLEAN, "show-hidden", TRUE);
407 if (p != NULL && p->type == P_BOOLEAN) {
408 file_browser_config.show_hidden = p->value.b;
409 }
410
411 p = rofi_theme_find_property(wid, P_STRING, "command", TRUE);
412 if (p != NULL && p->type == P_STRING) {
413 pd->command = g_strdup(p->value.s);
414 } else {
415 pd->command = g_strdup(DEFAULT_OPEN);
416 }
417
418 if (found_error) {
419 rofi_view_error_dialog(msg, FALSE);
420
421 g_free(msg);
422 }
423}
424
428
429 ThemeWidget *wid = rofi_config_find_widget(sw->name, NULL, TRUE);
430
431 Property *p = rofi_theme_find_property(wid, P_STRING, "directory", TRUE);
432
433 gboolean config_has_valid_dir = p != NULL && p->type == P_STRING &&
434 g_file_test(p->value.s, G_FILE_TEST_IS_DIR);
435
436 if (config_has_valid_dir) {
437 pd->current_dir = g_file_new_for_path(p->value.s);
438 } else {
439 char *current_dir = NULL;
440 char *cache_file =
441 g_build_filename(cache_dir, FILEBROWSER_CACHE_FILE, NULL);
442
443 if (g_file_get_contents(cache_file, &current_dir, NULL, NULL)) {
444 if (g_file_test(current_dir, G_FILE_TEST_IS_DIR)) {
445 pd->current_dir = g_file_new_for_path(current_dir);
446 }
447
448 g_free(current_dir);
449 }
450
451 // Store it based on the unique identifiers (desktop_id).
452 g_free(cache_file);
453 }
454
455 if (pd->current_dir == NULL) {
456 pd->current_dir = g_file_new_for_path(g_get_home_dir());
457 }
458}
459
464 if (mode_get_private_data(sw) == NULL) {
465 FileBrowserModePrivateData *pd = g_malloc0(sizeof(*pd));
466 mode_set_private_data(sw, (void *)pd);
467
470
471 // Load content.
473 }
474 return TRUE;
475}
476static unsigned int file_browser_mode_get_num_entries(const Mode *sw) {
479 return pd->array_length;
480}
481
482static ModeMode file_browser_mode_result(Mode *sw, int mretv, char **input,
483 unsigned int selected_line) {
484 ModeMode retv = MODE_EXIT;
487
488 if ((mretv & MENU_CANCEL) == MENU_CANCEL) {
489 ThemeWidget *wid = rofi_config_find_widget(sw->name, NULL, TRUE);
490 Property *p =
491 rofi_theme_find_property(wid, P_BOOLEAN, "cancel-returns-1", TRUE);
492 if (p && p->type == P_BOOLEAN && p->value.b == TRUE) {
494 }
495 return MODE_EXIT;
496 }
497 gboolean special_command =
499 if (mretv & MENU_CUSTOM_COMMAND) {
500 retv = (mretv & MENU_LOWER_MASK);
501 } else if ((mretv & MENU_OK)) {
502 if (selected_line < pd->array_length) {
503 if (pd->array[selected_line].type == UP) {
504 GFile *new = g_file_get_parent(pd->current_dir);
505 if (new) {
506 g_object_unref(pd->current_dir);
507 pd->current_dir = new;
508 free_list(pd);
510 return RESET_DIALOG;
511 }
512 } else if ((pd->array[selected_line].type == RFILE) ||
513 (pd->array[selected_line].type == DIRECTORY &&
514 special_command)) {
515 char *d_esc = g_shell_quote(pd->array[selected_line].path);
516 char *cmd = g_strdup_printf("%s %s", pd->command, d_esc);
517 g_free(d_esc);
518 char *cdir = g_file_get_path(pd->current_dir);
519 helper_execute_command(cdir, cmd, FALSE, NULL);
520 g_free(cdir);
521 g_free(cmd);
522 return MODE_EXIT;
523 } else if (pd->array[selected_line].type == DIRECTORY) {
524 char *path = g_build_filename(cache_dir, FILEBROWSER_CACHE_FILE, NULL);
525 g_file_set_contents(path, pd->array[selected_line].path, -1, NULL);
526 g_free(path);
527 GFile *new = g_file_new_for_path(pd->array[selected_line].path);
528 g_object_unref(pd->current_dir);
529 pd->current_dir = new;
530 free_list(pd);
532 return RESET_DIALOG;
533 }
534 }
535 retv = RELOAD_DIALOG;
536 } else if ((mretv & MENU_CUSTOM_INPUT)) {
537 if (special_command) {
538 GFile *new = g_file_get_parent(pd->current_dir);
539 if (new) {
540 g_object_unref(pd->current_dir);
541 pd->current_dir = new;
542 free_list(pd);
544 }
545 return RESET_DIALOG;
546 }
547 if (*input) {
548 char *p = rofi_expand_path(*input);
549 char *dir = g_filename_from_utf8(p, -1, NULL, NULL, NULL);
550 g_free(p);
551 if (g_file_test(dir, G_FILE_TEST_EXISTS)) {
552 if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
553 g_object_unref(pd->current_dir);
554 pd->current_dir = g_file_new_for_path(dir);
555 g_free(dir);
556 free_list(pd);
558 return RESET_DIALOG;
559 }
560 }
561 g_free(dir);
562 retv = RELOAD_DIALOG;
563 }
564 } else if ((mretv & MENU_ENTRY_DELETE) == MENU_ENTRY_DELETE) {
565 file_browser_config.show_hidden = !file_browser_config.show_hidden;
566 free_list(pd);
568 retv = RELOAD_DIALOG;
569 }
570 return retv;
571}
572
576 if (pd != NULL) {
577 g_object_unref(pd->current_dir);
578 g_free(pd->command);
579 free_list(pd);
580 g_free(pd);
581 mode_set_private_data(sw, NULL);
582 }
583}
584
585static char *_get_display_value(const Mode *sw, unsigned int selected_line,
586 G_GNUC_UNUSED int *state,
587 G_GNUC_UNUSED GList **attr_list,
588 int get_entry) {
591
592 // Only return the string if requested, otherwise only set state.
593 if (!get_entry) {
594 return NULL;
595 }
596 if (pd->array[selected_line].type == UP) {
597 return g_strdup(" ..");
598 }
599 if (pd->array[selected_line].link) {
600 return g_strconcat("@", pd->array[selected_line].name, NULL);
601 }
602 return g_strdup(pd->array[selected_line].name);
603}
604
614static int file_browser_token_match(const Mode *sw, rofi_int_matcher **tokens,
615 unsigned int index) {
618
619 // Call default matching function.
620 return helper_token_match(tokens, pd->array[index].name);
621}
622
623static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
624 unsigned int height) {
627 const guint scale = display_scale();
628 g_return_val_if_fail(pd->array != NULL, NULL);
629 FBFile *dr = &(pd->array[selected_line]);
632 } else if (dr->type == RFILE) {
633 gchar *_path = g_strconcat("thumbnail://", dr->path, NULL);
634 dr->icon_fetch_uid = rofi_icon_fetcher_query(_path, height);
635 g_free(_path);
636 } else {
638 }
639 dr->icon_fetch_size = height;
640 dr->icon_fetch_scale = scale;
642}
643
644static char *_get_message(const Mode *sw) {
647 if (pd->current_dir) {
648 char *dirname = g_file_get_parse_name(pd->current_dir);
649 char *str =
650 g_markup_printf_escaped("<b>Current directory:</b> %s", dirname);
651 g_free(dirname);
652 return str;
653 }
654 return "n/a";
655}
656
657static char *_get_completion(const Mode *sw, unsigned int index) {
660
661 char *d = g_strescape(pd->array[index].path, NULL);
662 return d;
663}
664
666 Mode *sw = g_malloc0(sizeof(Mode));
667
668 *sw = file_browser_mode;
669
670 sw->private_data = NULL;
671 return sw;
672}
673
674#if 1
675ModeMode file_browser_mode_completer(Mode *sw, int mretv, char **input,
676 unsigned int selected_line, char **path) {
677 ModeMode retv = MODE_EXIT;
680 if ((mretv & MENU_OK)) {
681 if (selected_line < pd->array_length) {
682 if (pd->array[selected_line].type == UP) {
683 GFile *new = g_file_get_parent(pd->current_dir);
684 if (new) {
685 g_object_unref(pd->current_dir);
686 pd->current_dir = new;
687 free_list(pd);
689 return RESET_DIALOG;
690 }
691 } else if (pd->array[selected_line].type == DIRECTORY) {
692 GFile *new = g_file_new_for_path(pd->array[selected_line].path);
693 g_object_unref(pd->current_dir);
694 pd->current_dir = new;
695 free_list(pd);
697 return RESET_DIALOG;
698 } else if (pd->array[selected_line].type == RFILE) {
699 *path = g_strescape(pd->array[selected_line].path, NULL);
700 return MODE_EXIT;
701 }
702 }
703 retv = RELOAD_DIALOG;
704 } else if ((mretv & MENU_CUSTOM_INPUT) && *input) {
705 char *p = rofi_expand_path(*input);
706 char *dir = g_filename_from_utf8(p, -1, NULL, NULL, NULL);
707 g_free(p);
708 if (g_file_test(dir, G_FILE_TEST_EXISTS)) {
709 if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
710 g_object_unref(pd->current_dir);
711 pd->current_dir = g_file_new_for_path(dir);
712 g_free(dir);
713 free_list(pd);
715 return RESET_DIALOG;
716 }
717 }
718 g_free(dir);
719 retv = RELOAD_DIALOG;
720 } else if ((mretv & MENU_ENTRY_DELETE) == MENU_ENTRY_DELETE) {
721 file_browser_config.show_hidden = !file_browser_config.show_hidden;
722 free_list(pd);
724 retv = RELOAD_DIALOG;
725 }
726 return retv;
727}
728#endif
729
730Mode file_browser_mode = {.display_name = NULL,
731 .abi_version = ABI_VERSION,
732 .name = "filebrowser",
733 .cfg_name_key = "display-filebrowser",
734 ._init = file_browser_mode_init,
735 ._get_num_entries = file_browser_mode_get_num_entries,
736 ._result = file_browser_mode_result,
737 ._destroy = file_browser_mode_destroy,
738 ._token_match = file_browser_token_match,
739 ._get_display_value = _get_display_value,
740 ._get_icon = _get_icon,
741 ._get_message = _get_message,
742 ._get_completion = _get_completion,
743 ._preprocess_input = NULL,
744 ._create = create_new_file_browser,
746 .private_data = NULL,
747 .free = NULL,
guint display_scale(void)
Definition display.c:78
static int file_browser_token_match(const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
static char * _get_message(const Mode *sw)
static void free_list(FileBrowserModePrivateData *pd)
static char * _get_completion(const Mode *sw, unsigned int index)
static unsigned int file_browser_mode_get_num_entries(const Mode *sw)
static void set_collate_key(FBFile *file)
FBFileType
Definition filebrowser.c:66
@ NUM_FILE_TYPES
Definition filebrowser.c:70
@ DIRECTORY
Definition filebrowser.c:68
@ UP
Definition filebrowser.c:67
@ RFILE
Definition filebrowser.c:69
static cairo_surface_t * _get_icon(const Mode *sw, unsigned int selected_line, unsigned int height)
static void file_browser_mode_init_current_dir(Mode *sw)
static void fb_resize_array(FileBrowserModePrivateData *pd)
static void set_time(FBFile *file)
#define FILEBROWSER_CACHE_FILE
Definition filebrowser.c:53
static gint compare_time(gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer data)
static void file_browser_mode_destroy(Mode *sw)
static gint compare_name(gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer data)
FBSortingMethod
Definition filebrowser.c:76
@ FB_SORT_NAME
Definition filebrowser.c:77
@ FB_SORT_TIME
Definition filebrowser.c:78
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)
static void get_file_browser(Mode *sw)
FBSortingTime
Definition filebrowser.c:84
@ FB_CTIME
Definition filebrowser.c:87
@ FB_MTIME
Definition filebrowser.c:85
@ FB_ATIME
Definition filebrowser.c:86
static int file_browser_mode_init(Mode *sw)
static ModeMode file_browser_mode_result(Mode *sw, int mretv, char **input, unsigned int selected_line)
static void file_browser_mode_init_config(Mode *sw)
const char * icon_name[NUM_FILE_TYPES]
Definition filebrowser.c:91
#define DEFAULT_OPEN
Definition filebrowser.c:55
struct @007246055303272251320153027260216112123134350321 file_browser_config
static time_t get_time(const GStatBuf *statbuf)
static gint compare(gconstpointer a, gconstpointer b, gpointer data)
Mode file_browser_mode
Mode * create_new_file_browser(void)
ModeMode file_browser_mode_completer(Mode *sw, int mretv, char **input, unsigned int selected_line, char **path)
Property * rofi_theme_find_property(ThemeWidget *wid, PropertyType type, const char *property, gboolean exact)
Definition theme.c:745
gboolean helper_execute_command(const char *wd, const char *cmd, gboolean run_in_term, RofiHelperExecuteContext *context)
Definition helper.c:1457
ThemeWidget * rofi_config_find_widget(const char *name, const char *state, gboolean exact)
Definition theme.c:782
char * rofi_expand_path(const char *input)
Definition helper.c:784
int helper_token_match(rofi_int_matcher *const *tokens, const char *input)
Definition helper.c:541
char * rofi_force_utf8(const gchar *data, ssize_t length)
Definition helper.c:862
gboolean rofi_icon_fetcher_file_is_image(const char *const path)
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
void mode_set_private_data(Mode *mode, void *pd)
Definition mode.c:181
ModeMode
Definition mode.h:54
@ MENU_CUSTOM_COMMAND
Definition mode.h:84
@ MENU_LOWER_MASK
Definition mode.h:92
@ MENU_CANCEL
Definition mode.h:74
@ MENU_ENTRY_DELETE
Definition mode.h:80
@ MENU_CUSTOM_ACTION
Definition mode.h:90
@ 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
@ RESET_DIALOG
Definition mode.h:64
void rofi_set_return_code(int code)
Definition rofi.c:155
const char * cache_dir
Definition rofi.c:86
int rofi_view_error_dialog(const char *msg, int markup)
Definition view.c:1980
@ MODE_TYPE_COMPLETER
@ MODE_TYPE_SWITCHER
#define ABI_VERSION
Definition mode.h:36
FBFileType
@ P_BOOLEAN
Definition rofi-types.h:18
@ P_STRING
Definition rofi-types.h:16
struct rofi_int_matcher_t rofi_int_matcher
char * path
Definition filebrowser.c:94
guint icon_fetch_scale
Definition filebrowser.c:98
enum FBFileType type
Definition filebrowser.c:95
gboolean link
Definition filebrowser.c:99
char * collate_key
uint32_t icon_fetch_size
Definition filebrowser.c:97
char * name
Definition filebrowser.c:93
uint32_t icon_fetch_uid
Definition filebrowser.c:96
time_t time
PropertyValue value
Definition rofi-types.h:293
PropertyType type
Definition rofi-types.h:291
enum FBSortingTime sorting_time
enum FBSortingMethod sorting_method
_mode_completer_result _completer_result
char * name
void * private_data