diff --git a/config/config.c b/config/config.c index ced69c34..da8d31e5 100644 --- a/config/config.c +++ b/config/config.c @@ -69,5 +69,6 @@ Settings config = { .padding = 5, .show_title = 1, .y_offset = 0, - .x_offset = 0 + .x_offset = 0, + .fixed_num_lines = 0 }; diff --git a/include/rofi.h b/include/rofi.h index 43bdf10f..d26b45a7 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -105,6 +105,7 @@ typedef struct _Settings int x_offset; unsigned int show_title; + unsigned int fixed_num_lines; } Settings; diff --git a/source/rofi.c b/source/rofi.c index 43e9ecab..701117fa 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1031,8 +1031,14 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi ; } + unsigned int max_lines = MIN ( config.menu_lines, num_lines ); + if ( config.fixed_num_lines == 1 ) + { + max_lines = config.menu_lines; + } + // Calculate as float to stop silly, big rounding down errors. int w = config.menu_width < 101 ? ( mon.w / 100.0f ) * ( float ) config.menu_width : config.menu_width; int x = mon.x + ( mon.w - w ) / 2; @@ -1184,6 +1190,7 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi // Subtract the margin of the last row. int h = line_height * ( max_lines + 1 ) + ( config.padding ) * 2 + LINE_MARGIN; + if ( config.wmode == HORIZONTAL ) { h = line_height + ( config.padding ) * 2; diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 771feb01..a61ba38c 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -51,21 +51,22 @@ typedef struct }; } XrmOption; XrmOption xrmOptions[] = { - { xrm_Number, "opacity", { .num = &config.window_opacity } }, - { xrm_Number, "width", { .num = &config.menu_width } }, - { xrm_Number, "lines", { .num = &config.menu_lines } }, - { xrm_String, "font", { .str = &config.menu_font } }, - { xrm_String, "foreground", { .str = &config.menu_fg } }, - { xrm_String, "background", { .str = &config.menu_bg } }, - { xrm_String, "highlightfg", { .str = &config.menu_hlfg } }, - { xrm_String, "highlightbg", { .str = &config.menu_hlbg } }, - { xrm_String, "bordercolor", { .str = &config.menu_bc } }, - { xrm_Number, "padding", { .num = &config.padding } }, - { xrm_Number, "borderwidth", { .num = &config.menu_bw } }, - { xrm_String, "terminal", { .str = &config.terminal_emulator } }, - { xrm_Number, "location", { .num = &config.location } }, - { xrm_Number, "yoffset", { .num = &config.y_offset } }, - { xrm_Number, "xoffset", { .num = &config.x_offset } }, + { xrm_Number, "opacity", { .num = &config.window_opacity } }, + { xrm_Number, "width", { .num = &config.menu_width } }, + { xrm_Number, "lines", { .num = &config.menu_lines } }, + { xrm_String, "font", { .str = &config.menu_font } }, + { xrm_String, "foreground", { .str = &config.menu_fg } }, + { xrm_String, "background", { .str = &config.menu_bg } }, + { xrm_String, "highlightfg", { .str = &config.menu_hlfg } }, + { xrm_String, "highlightbg", { .str = &config.menu_hlbg } }, + { xrm_String, "bordercolor", { .str = &config.menu_bc } }, + { xrm_Number, "padding", { .num = &config.padding } }, + { xrm_Number, "borderwidth", { .num = &config.menu_bw } }, + { xrm_String, "terminal", { .str = &config.terminal_emulator } }, + { xrm_Number, "location", { .num = &config.location } }, + { xrm_Number, "yoffset", { .num = &config.y_offset } }, + { xrm_Number, "xoffset", { .num = &config.x_offset } }, + { xrm_Number, "fixed_num_lines", { .num = &config.fixed_num_lines } }, };