From 97fa0cc61d26be6b28bd615f12575b4004cc02a5 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 13 Dec 2015 13:51:59 +0100 Subject: [PATCH] Add option to set scrollbar width --- Changelog | 1 + config/config.def.c | 1 + doc/rofi-manpage.markdown | 4 ++++ doc/rofi.1 | 6 ++++++ include/rofi.h | 1 + source/rofi.c | 2 +- source/xrmoptions.c | 3 ++- 7 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 38e3a55b..d7655171 100644 --- a/Changelog +++ b/Changelog @@ -11,6 +11,7 @@ - Regex matching (#113) - Take Screenshot of rofi using keybinding. - Hotkey for sorting: (#298) + - Option to set scrollbar width. Improvements: - Fix return code of multi-select. - Update manpage (#289, #291) diff --git a/config/config.def.c b/config/config.def.c index 8ab8bf27..3775eb16 100644 --- a/config/config.def.c +++ b/config/config.def.c @@ -150,4 +150,5 @@ Settings config = { .fake_transparency = FALSE, .dpi = -1, .threads = 1, + .scrollbar_width = 8, }; diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index 3076459a..d9b744c1 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -359,6 +359,10 @@ Set separator style. Possible options are "none", "solid" or "dash". Hide the scrollbar. +`-scrollbar-width` *width* + +Set the scrollbar width. + `-glob` Use glob style matching diff --git a/doc/rofi.1 b/doc/rofi.1 index 07ef4609..b879eb8f 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -598,6 +598,12 @@ Default: *dash* Hide the scrollbar\. . .P +\fB\-scrollbar\-width\fR \fIwidth\fR +. +.P +Set the scrollbar width\. +. +.P \fB\-glob\fR . .P diff --git a/include/rofi.h b/include/rofi.h index b46f6ce1..a08cdddc 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -230,6 +230,7 @@ typedef struct _Settings int dpi; /** Number threads (1 to disable) */ unsigned int threads; + unsigned int scrollbar_width; } Settings; /** Global Settings structure. */ diff --git a/source/rofi.c b/source/rofi.c index 4e84a53b..d2c429db 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1382,7 +1382,7 @@ MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_l state.element_width, element_height, NORMAL, "" ); } if ( !config.hide_scrollbar ) { - unsigned int sbw = config.line_margin + 8; + unsigned int sbw = config.line_margin+config.scrollbar_width; state.scrollbar = scrollbar_create ( state.w - state.border - sbw, state.top_offset, sbw, ( state.max_rows - 1 ) * ( element_height + config.line_margin ) + element_height ); } diff --git a/source/xrmoptions.c b/source/xrmoptions.c index ab7159cf..bc7c7b9d 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -138,7 +138,8 @@ static XrmOption xrmOptions[] = { { xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL, "Fullscreen" }, { xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL, "Fake transparency" }, { xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL, "DPI" }, - { xrm_Number, "threads", { .num = &config.threads }, NULL, "Threads to use for string matching" } + { xrm_Number, "threads", { .num = &config.threads }, NULL, "Threads to use for string matching" }, + { xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL, "Scrollbar width" } }; // Dynamic options.