From f10b879cac73f509ad18c3346a18df2dc702a14a Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 1 Feb 2017 21:07:07 +0100 Subject: [PATCH] Async pre-read 25 entries by default, to make it feel more snappy. Fixes #550 --- doc/rofi-manpage.markdown | 6 ++++++ doc/rofi.1 | 11 ++++++++++- source/dialogs/dmenu.c | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index c1982efe..3732131e 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -650,6 +650,12 @@ Force rofi mode to first read all data from stdin before showing selection windo Note: the default asynchronous mode will also be automatically disabled if used with conflicting options such as `-dump`, `-only-match` or `-auto-select` +`-async-pre-read` *number* + +Reads the first 25 entries blocking. Then switches to async mode. This makes it feel more 'snappy'. + +*default*: 25 + ### Message dialog `-e` *message* diff --git a/doc/rofi.1 b/doc/rofi.1 index 07cb3a9c..75872cbe 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\-MANPAGE" "" "January 2017" "" "" +.TH "ROFI\-MANPAGE" "" "February 2017" "" "" . .SH "NAME" \fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement @@ -1007,6 +1007,15 @@ Force rofi mode to first read all data from stdin before showing selection windo .P Note: the default asynchronous mode will also be automatically disabled if used with conflicting options such as \fB\-dump\fR, \fB\-only\-match\fR or \fB\-auto\-select\fR . +.P +\fB\-async\-pre\-read\fR \fInumber\fR +. +.P +Reads the first 25 entries blocking\. Then switches to async mode\. This makes it feel more \'snappy\'\. +. +.P +\fIdefault\fR: 25 +. .SS "Message dialog" \fB\-e\fR \fImessage\fR . diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index c4f056a7..63e5a189 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -635,7 +635,7 @@ int dmenu_switcher_dialog ( void ) async = FALSE; } if ( async ) { - unsigned int pre_read = 0; + unsigned int pre_read = 25; find_arg_uint("-async-pre-read", &pre_read); async = get_dmenu_async ( pd, pre_read ); } @@ -728,4 +728,5 @@ void print_dmenu_options ( void ) print_help_msg ( "-sep", "[char]", "Element separator.", "'\\n'", is_term ); print_help_msg ( "-input", "[filename]", "Read input from file instead from standard input.", NULL, is_term ); print_help_msg ( "-sync", "", "Force dmenu to first read all input data, then show dialog.", NULL, is_term ); + print_help_msg ( "-async-pre-read", "[number]", "Read several entries blocking before switching to async mode", "25", is_term); }