mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
[DRun] Only go to file completer if desktop file support url.
This commit is contained in:
parent
6446cd430b
commit
14943ad337
2 changed files with 16 additions and 7 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue