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); } diff --git a/source/view.c b/source/view.c index 097ea193..967178f8 100644 --- a/source/view.c +++ b/source/view.c @@ -1084,16 +1084,13 @@ static void rofi_view_refilter ( RofiViewState *state ) state->retv = MENU_OK; state->quit = TRUE; } - - // Make sure we enable fixed num lines when in normal window mode. - if ( ( CacheState.flags & MENU_NORMAL_WINDOW ) == 0 ) { - int height = rofi_view_calculate_height ( state ); - if ( height != state->height ) { - state->height = height; - rofi_view_calculate_window_position ( state ); - rofi_view_window_update_size ( state ); - g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Resize based on re-filter" ); - } + // Size the window. + int height = rofi_view_calculate_height ( state ); + if ( height != state->height ) { + state->height = height; + rofi_view_calculate_window_position ( state ); + rofi_view_window_update_size ( state ); + g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Resize based on re-filter" ); } state->refilter = FALSE; TICK_N ( "Filter done" );