mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
[DRUN] Add drun-display-format.
This commit is contained in:
parent
f80e7d52bc
commit
76ceac1f20
7 changed files with 62 additions and 12 deletions
|
@ -116,6 +116,8 @@ Settings config = {
|
||||||
.matching_method = MM_NORMAL,
|
.matching_method = MM_NORMAL,
|
||||||
/** Desktop entry fields to match*/
|
/** Desktop entry fields to match*/
|
||||||
.drun_match_fields = "name,generic,exec,categories",
|
.drun_match_fields = "name,generic,exec,categories",
|
||||||
|
/** Desktop format display */
|
||||||
|
.drun_display_format = "{name} [<span weight='light' size='small'><i>({generic})</i></span>]",
|
||||||
/** Desktop entry show actions */
|
/** Desktop entry show actions */
|
||||||
.drun_show_actions = FALSE,
|
.drun_show_actions = FALSE,
|
||||||
/** Desktop entry show actions */
|
/** Desktop entry show actions */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "ROFI\-THEME\-SELECTOR" "1" "July 2018" "" ""
|
.TH "ROFI\-THEME\-SELECTOR" "1" "March 2018" "" ""
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR
|
\fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR
|
||||||
|
|
28
doc/rofi.1
28
doc/rofi.1
|
@ -1,7 +1,7 @@
|
||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "ROFI" "1" "September 2018" "" ""
|
.TH "ROFI" "1" "October 2018" "" ""
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBrofi\fR \- A window switcher, application launcher, ssh dialog and dmenu replacement
|
\fBrofi\fR \- A window switcher, application launcher, ssh dialog and dmenu replacement
|
||||||
|
@ -414,6 +414,32 @@ Default: \fIname,generic,exec,categories\fR
|
||||||
.IP "" 0
|
.IP "" 0
|
||||||
.
|
.
|
||||||
.P
|
.P
|
||||||
|
\fB\-drun\-display\-format\fR
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
The format string for the drun dialog:
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
|
\fBname\fR: the application\'s name
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
|
\fBgeneric\fR: the application\'s generic name
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
|
\fBexec\fR: the application\'s executable
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
|
\fBcategories\fR: the application\'s categories
|
||||||
|
.
|
||||||
|
.IP "\(bu" 4
|
||||||
|
\fBcomment\fR: the application comment
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
Default: \fI{name} [\fI({generic})\fR]\fR
|
||||||
|
.
|
||||||
|
.IP "" 0
|
||||||
|
.
|
||||||
|
.P
|
||||||
\fB\-[no\-]drun\-show\-actions\fR
|
\fB\-[no\-]drun\-show\-actions\fR
|
||||||
.
|
.
|
||||||
.P
|
.P
|
||||||
|
|
|
@ -239,6 +239,18 @@ The different fields are:
|
||||||
|
|
||||||
Default: *name,generic,exec,categories*
|
Default: *name,generic,exec,categories*
|
||||||
|
|
||||||
|
`-drun-display-format`
|
||||||
|
|
||||||
|
The format string for the drun dialog:
|
||||||
|
|
||||||
|
* **name**: the application's name
|
||||||
|
* **generic**: the application's generic name
|
||||||
|
* **exec**: the application's executable
|
||||||
|
* **categories**: the application's categories
|
||||||
|
* **comment**: the application comment
|
||||||
|
|
||||||
|
Default: *{name} [<span weight='light' size='small'><i>({generic})</i></span>]*
|
||||||
|
|
||||||
`-[no-]drun-show-actions`
|
`-[no-]drun-show-actions`
|
||||||
|
|
||||||
Show actions present in the Desktop files.
|
Show actions present in the Desktop files.
|
||||||
|
|
|
@ -118,6 +118,8 @@ typedef struct
|
||||||
char * drun_match_fields;
|
char * drun_match_fields;
|
||||||
/** Desktop entry show actions */
|
/** Desktop entry show actions */
|
||||||
unsigned int drun_show_actions;
|
unsigned int drun_show_actions;
|
||||||
|
/** Desktop entry show */
|
||||||
|
char * drun_display_format;
|
||||||
/** Search case sensitivity */
|
/** Search case sensitivity */
|
||||||
unsigned int case_sensitive;
|
unsigned int case_sensitive;
|
||||||
/** Cycle through in the element list */
|
/** Cycle through in the element list */
|
||||||
|
|
|
@ -756,13 +756,19 @@ static char *_get_display_value ( const Mode *sw, unsigned int selected_line, in
|
||||||
}
|
}
|
||||||
/* Free temp storage. */
|
/* Free temp storage. */
|
||||||
DRunModeEntry *dr = &( pd->entry_list[selected_line] );
|
DRunModeEntry *dr = &( pd->entry_list[selected_line] );
|
||||||
if ( dr->generic_name == NULL ) {
|
gchar *cats = NULL;
|
||||||
return g_markup_printf_escaped ( "%s", dr->name );
|
if ( dr->categories ){
|
||||||
}
|
cats = g_strjoinv(",", dr->categories);
|
||||||
else {
|
|
||||||
return g_markup_printf_escaped ( "%s <span weight='light' size='small'><i>(%s)</i></span>", dr->name,
|
|
||||||
dr->generic_name );
|
|
||||||
}
|
}
|
||||||
|
char *retv = helper_string_replace_if_exists ( config.drun_display_format,
|
||||||
|
"{generic}", dr->generic_name,
|
||||||
|
"{name}", dr->name,
|
||||||
|
"{comment}", dr->comment,
|
||||||
|
"{exec}", dr->exec,
|
||||||
|
"{categories}", cats,
|
||||||
|
NULL);
|
||||||
|
g_free(cats);
|
||||||
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *_get_icon ( const Mode *sw, unsigned int selected_line, int height )
|
static cairo_surface_t *_get_icon ( const Mode *sw, unsigned int selected_line, int height )
|
||||||
|
|
|
@ -137,6 +137,8 @@ static XrmOption xrmOptions[] = {
|
||||||
"Desktop entry fields to match in drun", CONFIG_DEFAULT },
|
"Desktop entry fields to match in drun", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "drun-show-actions", { .num = &config.drun_show_actions }, NULL,
|
{ xrm_Boolean, "drun-show-actions", { .num = &config.drun_show_actions }, NULL,
|
||||||
"Desktop entry show actions.", CONFIG_DEFAULT },
|
"Desktop entry show actions.", CONFIG_DEFAULT },
|
||||||
|
{ xrm_String, "drun-display-format", { .str = &config.drun_display_format }, NULL,
|
||||||
|
"DRUN format string. (Supports: generic,name,comment,exec,categories)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
||||||
"Disable history in run/ssh", CONFIG_DEFAULT },
|
"Disable history in run/ssh", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
|
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
|
||||||
|
|
Loading…
Reference in a new issue