summaryrefslogtreecommitdiffstats
path: root/source/modes/filebrowser.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/modes/filebrowser.c')
-rw-r--r--source/modes/filebrowser.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/modes/filebrowser.c b/source/modes/filebrowser.c
index 9095fc71..b8ee2161 100644
--- a/source/modes/filebrowser.c
+++ b/source/modes/filebrowser.c
@@ -50,6 +50,7 @@
#include "rofi-icon-fetcher.h"
#define FILEBROWSER_CACHE_FILE "rofi3.filebrowsercache"
+#define DEFAULT_OPEN "xdg-open"
#if defined(__APPLE__)
#define st_atim st_atimespec
@@ -97,6 +98,7 @@ typedef struct {
} FBFile;
typedef struct {
+ char *command;
GFile *current_dir;
FBFile *array;
unsigned int array_length;
@@ -344,6 +346,7 @@ static void get_file_browser(Mode *sw) {
}
static void file_browser_mode_init_config(Mode *sw) {
+ FileBrowserModePrivateData * pd = (FileBrowserModePrivateData*)mode_get_private_data(sw);
char *msg = NULL;
gboolean found_error = FALSE;
@@ -380,6 +383,14 @@ static void file_browser_mode_init_config(Mode *sw) {
file_browser_config.show_hidden = p->value.b;
}
+ p = rofi_theme_find_property(wid, P_STRING, "command", TRUE);
+ if ( p != NULL && p->type == P_STRING ) {
+ pd->command = g_strdup(p->value.s);
+ } else {
+ pd->command = g_strdup(DEFAULT_OPEN);
+ }
+
+
if (found_error) {
rofi_view_error_dialog(msg, FALSE);
@@ -484,7 +495,7 @@ static ModeMode file_browser_mode_result(Mode *sw, int mretv, char **input,
(pd->array[selected_line].type == DIRECTORY &&
special_command)) {
char *d_esc = g_shell_quote(pd->array[selected_line].path);
- char *cmd = g_strdup_printf("xdg-open %s", d_esc);
+ char *cmd = g_strdup_printf("%s %s",pd->command, d_esc);
g_free(d_esc);
char *cdir = g_file_get_path(pd->current_dir);
helper_execute_command(cdir, cmd, FALSE, NULL);
@@ -546,6 +557,7 @@ static void file_browser_mode_destroy(Mode *sw) {
(FileBrowserModePrivateData *)mode_get_private_data(sw);
if (pd != NULL) {
g_object_unref(pd->current_dir);
+ g_free(pd->command);
free_list(pd);
g_free(pd);
mode_set_private_data(sw, NULL);