mirror of
https://github.com/davatorium/rofi.git
synced 2024-10-27 05:23:18 -04: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
|
.IP \(bu 2
|
||||||
\fB\fCShift\-Enter\fR: Launch the application in a terminal (in run mode)
|
\fB\fCShift\-Enter\fR: Launch the application in a terminal (in run mode)
|
||||||
.IP \(bu 2
|
.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)
|
\fB\fCShift\-Enter\fR: Return the selected entry and move to the next item while keeping \fBrofi\fP open. (in dmenu)
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fB\fCShift\-Right\fR: Switch to the next mode. The list can be customized with the \fB\fC\-switchers\fR argument.
|
\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
|
See de debugging section how to get more information from the DRUN mode, this will print why desktop files are
|
||||||
discarded.
|
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
|
.SS ssh
|
||||||
.PP
|
.PP
|
||||||
Shows a list of SSH targets based on your \fB\fCssh\fR config file, and allows to quickly \fB\fCssh\fR into them.
|
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
|
See de debugging section how to get more information from the DRUN mode, this will print why desktop files are
|
||||||
discarded.
|
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
|
### ssh
|
||||||
|
|
||||||
Shows a list of SSH targets based on your `ssh` config file, and allows to quickly `ssh` into them.
|
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 );
|
char *cache_file = g_build_filename ( cache_dir, DRUN_DESKTOP_CACHE_FILE, NULL );
|
||||||
TICK_N ( "Get Desktop apps (start)" );
|
TICK_N ( "Get Desktop apps (start)" );
|
||||||
if ( drun_read_cache ( pd, cache_file ) ) {
|
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;
|
gchar *dir;
|
||||||
// First read the user directory.
|
// First read the user directory.
|
||||||
dir = g_build_filename ( g_get_user_data_dir (), "applications", NULL );
|
dir = g_build_filename ( g_get_user_data_dir (), "applications", NULL );
|
||||||
walk_dir ( pd, dir, dir );
|
walk_dir ( pd, dir, dir );
|
||||||
g_free ( dir );
|
g_free ( dir );
|
||||||
TICK_N ( "Get Desktop apps (user 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.
|
// Then read thee system data dirs.
|
||||||
const gchar * const * sys = g_get_system_data_dirs ();
|
const gchar * const * sys = g_get_system_data_dirs ();
|
||||||
for ( const gchar * const *iter = sys; *iter != NULL; ++iter ) {
|
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...
|
// Check, we seem to be getting empty string...
|
||||||
if ( unique && ( **iter ) != '\0' ) {
|
if ( unique && ( **iter ) != '\0' ) {
|
||||||
dir = g_build_filename ( *iter, "applications", NULL );
|
char *dir = g_build_filename ( *iter, "applications", NULL );
|
||||||
walk_dir ( pd, dir, dir );
|
walk_dir ( pd, dir, dir );
|
||||||
g_free ( dir );
|
g_free ( dir );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TICK_N ( "Get Desktop apps (system dirs)" );
|
TICK_N ( "Get Desktop apps (system dirs)" );
|
||||||
|
}
|
||||||
get_apps_history ( pd );
|
get_apps_history ( pd );
|
||||||
|
|
||||||
g_qsort_with_data ( pd->entry_list, pd->cmd_list_length, sizeof ( DRunModeEntry ), drun_int_sort_list, NULL );
|
g_qsort_with_data ( pd->entry_list, pd->cmd_list_length, sizeof ( DRunModeEntry ), drun_int_sort_list, NULL );
|
||||||
|
|
Loading…
Reference in a new issue