diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index 7c6aac9c..f2117f3a 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -863,6 +863,10 @@ in a terminal if specified in the Desktop File. Pressing the `delete-entry` binding (`shift-delete`) will remove this entry from the run history. Pressing the `accept-custom` binding (`control-enter` or `shift-enter`) will run the command in a terminal. +When pressing the `mode-complete` binding (`Control-l`), you can use the File Browser mode to launch the application +passing a file as argument if specified in the desktop file. + + The DRUN mode tries to follows the [XDG Desktop Entry Specification](https://freedesktop.org/wiki/Specifications/desktop-entry-spec/) and should be compatible with applications using this standard. Some application create invalid desktop files, **rofi** will discard these entries. diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 51b9227a..fafc6068 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -1136,16 +1136,21 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i case DRUN_DESKTOP_ENTRY_TYPE_SERVICE: case DRUN_DESKTOP_ENTRY_TYPE_APPLICATION: { - rmpd->selected_line = selected_line; - // TODO add check if it supports passing file. + GRegex *regex = g_regex_new ("%[fFuU]", 0, 0, NULL); - g_free ( rmpd->old_input ); - rmpd->old_input = g_strdup ( *input ); + if (g_regex_match (regex, rmpd->entry_list[selected_line].exec, 0, NULL) ) { + rmpd->selected_line = selected_line; + // TODO add check if it supports passing file. - if ( *input ) g_free (*input); - *input = g_strdup ( rmpd->old_completer_input ); + g_free ( rmpd->old_input ); + rmpd->old_input = g_strdup ( *input ); - rmpd->file_complete = TRUE; + if ( *input ) g_free (*input); + *input = g_strdup ( rmpd->old_completer_input ); + + rmpd->file_complete = TRUE; + } + g_regex_unref ( regex ); } default: break;