1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[DRun] Only go to file completer if desktop file support url.

This commit is contained in:
Dave Davenport 2021-06-08 19:35:51 +02:00
parent 6b9de4644e
commit 6178970499
2 changed files with 16 additions and 7 deletions

View file

@ -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 `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. 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 The DRUN mode tries to follows the [XDG Desktop Entry
Specification](https://freedesktop.org/wiki/Specifications/desktop-entry-spec/) and should be compatible with 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. applications using this standard. Some application create invalid desktop files, **rofi** will discard these entries.

View file

@ -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_SERVICE:
case DRUN_DESKTOP_ENTRY_TYPE_APPLICATION: case DRUN_DESKTOP_ENTRY_TYPE_APPLICATION:
{ {
rmpd->selected_line = selected_line; GRegex *regex = g_regex_new ("%[fFuU]", 0, 0, NULL);
// TODO add check if it supports passing file.
g_free ( rmpd->old_input ); if (g_regex_match (regex, rmpd->entry_list[selected_line].exec, 0, NULL) ) {
rmpd->old_input = g_strdup ( *input ); rmpd->selected_line = selected_line;
// TODO add check if it supports passing file.
if ( *input ) g_free (*input); g_free ( rmpd->old_input );
*input = g_strdup ( rmpd->old_completer_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: default:
break; break;