From 3307d62c55b2f359c52bc9884b0472f9eae9aa47 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 15 Jun 2021 14:04:34 +0200 Subject: [PATCH] [Doc] Add new -display-{mode} method to manpage. --- doc/rofi.1 | 16 ++++++++++++++++ doc/rofi.1.markdown | 11 +++++++++++ source/mode.c | 4 +++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/rofi.1 b/doc/rofi.1 index b95af90a..5aaa0bef 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -1151,6 +1151,22 @@ Make \fBrofi\fP create a pid file and check this on startup. The pid file preven .PP Set the name to use for mode. This is used as prompt and in combi\-browser. +.PP +It is now prefered to use the configuration file: + +.PP +.RS + +.nf +configuration { + {mode} { + display\-name: *string*; + } +} + +.fi +.RE + .PP \fB\fC\-click\-to\-exit\fR \fB\fC\-no\-click\-to\-exit\fR diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index 0da0a0ba..716167eb 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -724,6 +724,17 @@ Make **rofi** create a pid file and check this on startup. The pid file prevents Set the name to use for mode. This is used as prompt and in combi-browser. +It is now prefered to use the configuration file: + +```css +configuration { + {mode} { + display-name: *string*; + } +} +``` + + `-click-to-exit` `-no-click-to-exit` diff --git a/source/mode.c b/source/mode.c index 8c0a9fc0..ae4b23be 100644 --- a/source/mode.c +++ b/source/mode.c @@ -153,10 +153,12 @@ void mode_set_private_data ( Mode *mode, void *pd ) const char *mode_get_display_name ( const Mode *mode ) { + /** Find the widget */ ThemeWidget *wid = rofi_config_find_widget ( mode->name, NULL, TRUE ); if ( wid ) { + /** Check string property */ Property *p = rofi_theme_find_property ( wid, P_STRING, "display-name", FALSE ); - if ( p != NULL ) { + if ( p != NULL && p->type == P_STRING ) { return p->value.s; } }