diff --git a/config/config.c b/config/config.c
index 625d14d9..d10876c0 100644
--- a/config/config.c
+++ b/config/config.c
@@ -116,6 +116,8 @@ Settings config = {
.matching_method = MM_NORMAL,
/** Desktop entry fields to match*/
.drun_match_fields = "name,generic,exec,categories",
+ /** Desktop format display */
+ .drun_display_format = "{name} [({generic})]",
/** Desktop entry show actions */
.drun_show_actions = FALSE,
/** Desktop entry show actions */
diff --git a/doc/rofi-theme-selector.1 b/doc/rofi-theme-selector.1
index 7d9878c9..bb521458 100644
--- a/doc/rofi-theme-selector.1
+++ b/doc/rofi-theme-selector.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.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"
\fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR
diff --git a/doc/rofi.1 b/doc/rofi.1
index b9c7d371..29897485 100644
--- a/doc/rofi.1
+++ b/doc/rofi.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "ROFI" "1" "September 2018" "" ""
+.TH "ROFI" "1" "October 2018" "" ""
.
.SH "NAME"
\fBrofi\fR \- A window switcher, application launcher, ssh dialog and dmenu replacement
@@ -414,6 +414,32 @@ Default: \fIname,generic,exec,categories\fR
.IP "" 0
.
.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
.
.P
diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown
index 5f0686c2..c76d243d 100644
--- a/doc/rofi.1.markdown
+++ b/doc/rofi.1.markdown
@@ -227,18 +227,30 @@ Tokenize the input.
`-drun-match-fields` *field1*,*field2*,...
-When using drun, match only with the specified Desktop entry fields.
+When using drun, match only with the specified Desktop entry fields.
The different fields are:
* **name**: the application's name
* **generic**: the application's generic name
-* **exec**: the application's executable
+* **exec**: the application's executable
* **categories**: the application's categories
* **comment**: the application comment
* **all**: all of the above
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} [({generic})]*
+
`-[no-]drun-show-actions`
Show actions present in the Desktop files.
@@ -247,12 +259,12 @@ Show actions present in the Desktop files.
`-window-match-fields` *field1*,*field2*,...
-When using window mode, match only with the specified fields.
+When using window mode, match only with the specified fields.
The different fields are:
* **title**: window's title
* **class**: window's class
-* **role**: window's role
+* **role**: window's role
* **name**: window's name
* **desktop**: window's current desktop
* **all**: all of the above
diff --git a/include/settings.h b/include/settings.h
index 8f1a2f5e..74580611 100644
--- a/include/settings.h
+++ b/include/settings.h
@@ -118,6 +118,8 @@ typedef struct
char * drun_match_fields;
/** Desktop entry show actions */
unsigned int drun_show_actions;
+ /** Desktop entry show */
+ char * drun_display_format;
/** Search case sensitivity */
unsigned int case_sensitive;
/** Cycle through in the element list */
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c
index 48293822..76423e21 100644
--- a/source/dialogs/drun.c
+++ b/source/dialogs/drun.c
@@ -756,13 +756,19 @@ static char *_get_display_value ( const Mode *sw, unsigned int selected_line, in
}
/* Free temp storage. */
DRunModeEntry *dr = &( pd->entry_list[selected_line] );
- if ( dr->generic_name == NULL ) {
- return g_markup_printf_escaped ( "%s", dr->name );
- }
- else {
- return g_markup_printf_escaped ( "%s (%s)", dr->name,
- dr->generic_name );
+ gchar *cats = NULL;
+ if ( dr->categories ){
+ cats = g_strjoinv(",", dr->categories);
}
+ 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 )
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index 4370b345..c8eb37cd 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -137,6 +137,8 @@ static XrmOption xrmOptions[] = {
"Desktop entry fields to match in drun", CONFIG_DEFAULT },
{ xrm_Boolean, "drun-show-actions", { .num = &config.drun_show_actions }, NULL,
"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,
"Disable history in run/ssh", CONFIG_DEFAULT },
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,