mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[DRun] Add advanced parse-user and parse-system config option.
This commit is contained in:
parent
74ef588d4e
commit
f72bae02bb
3 changed files with 63 additions and 16 deletions
21
doc/rofi.1
21
doc/rofi.1
|
@ -1257,6 +1257,8 @@ Please see \fBrofi\-theme(5)\fP manpage for more information on theming.
|
|||
.IP \(bu 2
|
||||
\fB\fCShift\-Enter\fR: Launch the application in a terminal (in run mode)
|
||||
.IP \(bu 2
|
||||
\fB\fCCtrl\-Shift\-Enter\fR: As Ctrl\-Enter and run the command in terminal (in run mode)
|
||||
.IP \(bu 2
|
||||
\fB\fCShift\-Enter\fR: Return the selected entry and move to the next item while keeping \fBrofi\fP open. (in dmenu)
|
||||
.IP \(bu 2
|
||||
\fB\fCShift\-Right\fR: Switch to the next mode. The list can be customized with the \fB\fC\-switchers\fR argument.
|
||||
|
@ -1338,6 +1340,25 @@ applications using this standard. Some application create invalid desktop files
|
|||
See de debugging section how to get more information from the DRUN mode, this will print why desktop files are
|
||||
discarded.
|
||||
|
||||
.PP
|
||||
There are two advanced options to tweak the behaviour:
|
||||
|
||||
.PP
|
||||
.RS
|
||||
|
||||
.nf
|
||||
configuration {
|
||||
drun {
|
||||
/** Parse user desktop files. */
|
||||
parse\-user: true;
|
||||
/** Parse system desktop files. */
|
||||
parse\-system: false;
|
||||
}
|
||||
}
|
||||
|
||||
.fi
|
||||
.RE
|
||||
|
||||
.SS ssh
|
||||
.PP
|
||||
Shows a list of SSH targets based on your \fB\fCssh\fR config file, and allows to quickly \fB\fCssh\fR into them.
|
||||
|
|
|
@ -855,6 +855,21 @@ applications using this standard. Some application create invalid desktop files
|
|||
See de debugging section how to get more information from the DRUN mode, this will print why desktop files are
|
||||
discarded.
|
||||
|
||||
There are two advanced options to tweak the behaviour:
|
||||
|
||||
```css
|
||||
configuration {
|
||||
drun {
|
||||
/** Parse user desktop files. */
|
||||
parse-user: true;
|
||||
/** Parse system desktop files. */
|
||||
parse-system: false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### ssh
|
||||
|
||||
Shows a list of SSH targets based on your `ssh` config file, and allows to quickly `ssh` into them.
|
||||
|
|
|
@ -947,12 +947,22 @@ static void get_apps ( DRunModePrivateData *pd )
|
|||
char *cache_file = g_build_filename ( cache_dir, DRUN_DESKTOP_CACHE_FILE, NULL );
|
||||
TICK_N ( "Get Desktop apps (start)" );
|
||||
if ( drun_read_cache ( pd, cache_file ) ) {
|
||||
ThemeWidget *wid = rofi_config_find_widget ( drun_mode.name, NULL, TRUE );
|
||||
|
||||
/** Load user entires */
|
||||
Property *p = rofi_theme_find_property ( wid, P_BOOLEAN, "parse-user", TRUE );
|
||||
if ( p == NULL || ( p->type == P_BOOLEAN && p->value.b )) {
|
||||
gchar *dir;
|
||||
// First read the user directory.
|
||||
dir = g_build_filename ( g_get_user_data_dir (), "applications", NULL );
|
||||
walk_dir ( pd, dir, dir );
|
||||
g_free ( dir );
|
||||
TICK_N ( "Get Desktop apps (user dir)" );
|
||||
}
|
||||
|
||||
/** Load application entires */
|
||||
p = rofi_theme_find_property ( wid, P_BOOLEAN, "parse-system", TRUE );
|
||||
if ( p == NULL || ( p->type == P_BOOLEAN && p->value.b )) {
|
||||
// Then read thee system data dirs.
|
||||
const gchar * const * sys = g_get_system_data_dirs ();
|
||||
for ( const gchar * const *iter = sys; *iter != NULL; ++iter ) {
|
||||
|
@ -965,12 +975,13 @@ static void get_apps ( DRunModePrivateData *pd )
|
|||
}
|
||||
// Check, we seem to be getting empty string...
|
||||
if ( unique && ( **iter ) != '\0' ) {
|
||||
dir = g_build_filename ( *iter, "applications", NULL );
|
||||
char *dir = g_build_filename ( *iter, "applications", NULL );
|
||||
walk_dir ( pd, dir, dir );
|
||||
g_free ( dir );
|
||||
}
|
||||
}
|
||||
TICK_N ( "Get Desktop apps (system dirs)" );
|
||||
}
|
||||
get_apps_history ( pd );
|
||||
|
||||
g_qsort_with_data ( pd->entry_list, pd->cmd_list_length, sizeof ( DRunModeEntry ), drun_int_sort_list, NULL );
|
||||
|
|
Loading…
Reference in a new issue