From d11c61cef1c83fc1cd1692b5c8971f482e556628 Mon Sep 17 00:00:00 2001 From: QC Date: Thu, 11 Jun 2015 20:38:48 +0200 Subject: [PATCH] Fixes #176 add mode that user expects. --- doc/rofi-manpage.markdown | 5 +++++ doc/rofi.1 | 14 ++++++++++++++ source/dialogs/dmenu.c | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index 66060a3d..1898e482 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -515,6 +515,11 @@ The following options are further explained in the theming section: Only return a selected item, do not allow custom entry. This mode always returns an entry, or returns directly when no entries given. +`-no-custom` + + Only return a selected item, do not allow custom entry. + This mode returns directly when no entries given. + `-format` *format* Allows the output of dmenu to be customized (N is total number of input entries): diff --git a/doc/rofi.1 b/doc/rofi.1 index d56e3deb..a8e0de4c 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -921,6 +921,20 @@ This mode always returns an entry, or returns directly when no entries given\. .IP "" 0 . .P +\fB\-no\-custom\fR +. +.IP "" 4 +. +.nf + +Only return a selected item, do not allow custom entry\. +This mode returns directly when no entries given\. +. +.fi +. +.IP "" 0 +. +.P \fB\-format\fR \fIformat\fR . .IP "" 4 diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 9358ee42..d0aa4516 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -217,7 +217,7 @@ int dmenu_switcher_dialog ( char **input ) } int only_selected = FALSE; - if ( find_arg ( "-only-match" ) >= 0 ) { + if ( find_arg ( "-only-match" ) >= 0 || find_arg ( "-no-custom" ) ) { only_selected = TRUE; if ( length == 0 ) { return TRUE; @@ -248,7 +248,7 @@ int dmenu_switcher_dialog ( char **input ) /** * Select item mode. */ - restart = TRUE; + restart = ( find_arg ( "-only-match" ) >= 0 ); if ( ( mretv & ( MENU_OK | MENU_QUICK_SWITCH ) ) && list[selected_line] != NULL ) { dmenu_output_formatted_line ( format, list[selected_line], selected_line, *input ); retv = TRUE;