mirror of
https://github.com/lbonn/rofi
synced 2024-11-15 08:37:17 +00:00
Add option to fix the size of rofi
This commit is contained in:
parent
08da286931
commit
f44fd74987
4 changed files with 26 additions and 16 deletions
|
@ -69,5 +69,6 @@ Settings config = {
|
||||||
.padding = 5,
|
.padding = 5,
|
||||||
.show_title = 1,
|
.show_title = 1,
|
||||||
.y_offset = 0,
|
.y_offset = 0,
|
||||||
.x_offset = 0
|
.x_offset = 0,
|
||||||
|
.fixed_num_lines = 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -105,6 +105,7 @@ typedef struct _Settings
|
||||||
int x_offset;
|
int x_offset;
|
||||||
|
|
||||||
unsigned int show_title;
|
unsigned int show_title;
|
||||||
|
unsigned int fixed_num_lines;
|
||||||
|
|
||||||
} Settings;
|
} Settings;
|
||||||
|
|
||||||
|
|
|
@ -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 );
|
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.
|
// 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 w = config.menu_width < 101 ? ( mon.w / 100.0f ) * ( float ) config.menu_width : config.menu_width;
|
||||||
int x = mon.x + ( mon.w - w ) / 2;
|
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.
|
// Subtract the margin of the last row.
|
||||||
int h = line_height * ( max_lines + 1 ) + ( config.padding ) * 2 + LINE_MARGIN;
|
int h = line_height * ( max_lines + 1 ) + ( config.padding ) * 2 + LINE_MARGIN;
|
||||||
|
|
||||||
|
|
||||||
if ( config.wmode == HORIZONTAL )
|
if ( config.wmode == HORIZONTAL )
|
||||||
{
|
{
|
||||||
h = line_height + ( config.padding ) * 2;
|
h = line_height + ( config.padding ) * 2;
|
||||||
|
|
|
@ -51,21 +51,22 @@ typedef struct
|
||||||
};
|
};
|
||||||
} XrmOption;
|
} XrmOption;
|
||||||
XrmOption xrmOptions[] = {
|
XrmOption xrmOptions[] = {
|
||||||
{ xrm_Number, "opacity", { .num = &config.window_opacity } },
|
{ xrm_Number, "opacity", { .num = &config.window_opacity } },
|
||||||
{ xrm_Number, "width", { .num = &config.menu_width } },
|
{ xrm_Number, "width", { .num = &config.menu_width } },
|
||||||
{ xrm_Number, "lines", { .num = &config.menu_lines } },
|
{ xrm_Number, "lines", { .num = &config.menu_lines } },
|
||||||
{ xrm_String, "font", { .str = &config.menu_font } },
|
{ xrm_String, "font", { .str = &config.menu_font } },
|
||||||
{ xrm_String, "foreground", { .str = &config.menu_fg } },
|
{ xrm_String, "foreground", { .str = &config.menu_fg } },
|
||||||
{ xrm_String, "background", { .str = &config.menu_bg } },
|
{ xrm_String, "background", { .str = &config.menu_bg } },
|
||||||
{ xrm_String, "highlightfg", { .str = &config.menu_hlfg } },
|
{ xrm_String, "highlightfg", { .str = &config.menu_hlfg } },
|
||||||
{ xrm_String, "highlightbg", { .str = &config.menu_hlbg } },
|
{ xrm_String, "highlightbg", { .str = &config.menu_hlbg } },
|
||||||
{ xrm_String, "bordercolor", { .str = &config.menu_bc } },
|
{ xrm_String, "bordercolor", { .str = &config.menu_bc } },
|
||||||
{ xrm_Number, "padding", { .num = &config.padding } },
|
{ xrm_Number, "padding", { .num = &config.padding } },
|
||||||
{ xrm_Number, "borderwidth", { .num = &config.menu_bw } },
|
{ xrm_Number, "borderwidth", { .num = &config.menu_bw } },
|
||||||
{ xrm_String, "terminal", { .str = &config.terminal_emulator } },
|
{ xrm_String, "terminal", { .str = &config.terminal_emulator } },
|
||||||
{ xrm_Number, "location", { .num = &config.location } },
|
{ xrm_Number, "location", { .num = &config.location } },
|
||||||
{ xrm_Number, "yoffset", { .num = &config.y_offset } },
|
{ xrm_Number, "yoffset", { .num = &config.y_offset } },
|
||||||
{ xrm_Number, "xoffset", { .num = &config.x_offset } },
|
{ xrm_Number, "xoffset", { .num = &config.x_offset } },
|
||||||
|
{ xrm_Number, "fixed_num_lines", { .num = &config.fixed_num_lines } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue