Re-add some of the old theme options, so theme converter use them.

- line margin
 - separator style.
 - fake transparency.
 - line padding.
 - scrollbar width
This commit is contained in:
Dave Davenport 2017-07-06 18:09:25 +02:00
parent 36856ecbac
commit ecc9bcc270
6 changed files with 164 additions and 71 deletions

View file

@ -111,12 +111,22 @@ Settings config = {
.matching_method = MM_NORMAL,
/** Monitor */
.monitor = "-5",
/** set line margin */
.line_margin = 2,
.line_padding = 1,
/** Set filter */
.filter = NULL,
/** Separator style: dash/solid */
.separator_style = "dash",
/** Hide scrollbar */
.hide_scrollbar = FALSE,
.fullscreen = FALSE,
.fake_transparency = FALSE,
.dpi = -1,
.threads = 0,
.scroll_method = 0,
.scrollbar_width = 8,
.fake_background = "screenshot",
.window_format = "{w} {i}{c} {t}",
.click_to_exit = TRUE,
.show_match = TRUE,

View file

@ -66,18 +66,32 @@ rofi.combi-modi: window,drun,run,ssh
rofi.tokenize: true
! "Monitor id to show on" Set from: File
rofi.m: -1
! "Margin between rows *DEPRECATED*" Set from: Default
! rofi.line-margin: 2
! "Padding within rows *DEPRECATED*" Set from: Default
! rofi.line-padding: 1
! "Pre-set filter" Set from: Default
! rofi.filter:
! "Separator style (none, dash, solid) *DEPRECATED*" Set from: Default
! rofi.separator-style: dash
! "Hide scroll-bar *DEPRECATED*" Set from: Default
! rofi.hide-scrollbar: false
! "Fullscreen" Set from: File
rofi.fullscreen: false
! "Fake transparency *DEPRECATED*" Set from: Default
! rofi.fake-transparency: false
! "DPI" Set from: File
rofi.dpi: 101
! "Threads to use for string matching" Set from: File
rofi.threads: 8
! "Scrollbar width *DEPRECATED*" Set from: Default
! rofi.scrollbar-width: 8
! "Scrolling method. (0: Page, 1: Centered)" Set from: File
rofi.scroll-method: 0
! "Window Format. w (desktop name), t (title), n (name), r (role), c (class)" Set from: File
rofi.window-format: w c t
! "Background to use for fake transparency. (background or screenshot)" Set from: Default
! rofi.fake-background: screenshot
! "Window Format. w (desktop name), t (title), n (name), r (role), c (class) *DEPRECATED*" Set from: Default
! rofi.window-format: {w} {i}{c} {t}
! "Click outside the window to exit" Set from: Default
! rofi.click-to-exit: true
! "Indicate how it match by underlining it." Set from: Default

View file

@ -82,7 +82,7 @@ const char *default_theme =
"}"
"#window.mainbox.listview {"
" fixed-height: 0;"
" border: 1px dash 0px 0px ;"
" border: 2px dash 0px 0px ;"
" padding: 2px 0px 0px ;"
"}"
"#window.mainbox.listview.element {"
@ -125,11 +125,11 @@ const char *default_theme =
" background: @alternate-active-background;"
"}"
"#window.mainbox.listview.scrollbar {"
" border: 0;"
" border: 0; width: 4px;"
" padding: 0;"
"}"
"#window.mainbox.sidebar.box {"
" border: 1px dash 0px 0px ;"
" border: 2px dash 0px 0px ;"
"}"
"#window.mainbox.sidebar button selected {"
" background: @selected-normal-background;"

View file

@ -158,15 +158,27 @@ typedef struct
unsigned int tokenize;
/** Monitors */
char *monitor;
/** Line margin */
unsigned int line_margin;
unsigned int line_padding;
/** filter */
char *filter;
/** style */
char *separator_style;
/** hide scrollbar */
unsigned int hide_scrollbar;
/** fullscreen */
unsigned int fullscreen;
/** bg image */
unsigned int fake_transparency;
/** dpi */
int dpi;
/** Number threads (1 to disable) */
unsigned int threads;
unsigned int scroll_method;
unsigned int scrollbar_width;
/** Background type */
char *fake_background;
char *window_format;
/** Click outside the window to exit */

View file

@ -758,6 +758,49 @@ void rofi_theme_convert_old ( void )
}
g_strfreev ( retv );
}
if ( config.separator_style != NULL ) {
if ( g_strcmp0 ( config.separator_style, "none" ) == 0 ) {
const char *const str = "#window.mainbox.listview box { border: 0px; }";
rofi_theme_parse_string ( str );
const char *const str2 = "#window.mainbox.sidebar box { border: 0px; }";
rofi_theme_parse_string ( str2 );
}
else if ( g_strcmp0 ( config.separator_style, "solid" ) == 0 ) {
const char *const str = "#window.mainbox.listview box { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str );
const char *const str2 = "#window.mainbox.sidebar box { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str2 );
} /* dash is default */
}
/* Line Margin */
{
char *str = g_strdup_printf ( "#window.mainbox.listview box { spacing: %dpx;}", config.line_margin );
rofi_theme_parse_string ( str );
g_free ( str );
}
/* Line Padding */
{
char *str = g_strdup_printf ( "#window.mainbox.listview.element { padding: %dpx;}", config.line_padding );
rofi_theme_parse_string ( str );
g_free ( str );
}
if ( config.hide_scrollbar ) {
const char *str = "#window.mainbox.listview.box { scrollbar: false; }";
rofi_theme_parse_string ( str );
}
else {
const char *str = "#window.mainbox.listview.box { scrollbar: true; }";
rofi_theme_parse_string ( str );
char *str2 = g_strdup_printf ( "#window.mainbox.listview.scrollbar { handle-width: %dpx; }", config.scrollbar_width );
rofi_theme_parse_string ( str2 );
g_free ( str2 );
}
if ( config.fake_transparency ) {
char *str = g_strdup_printf ( "#window { transparency: \"%s\"; }", config.fake_background );
rofi_theme_parse_string ( str );
g_free ( str );
}
}
#endif // THEME_CONVERTER

View file

@ -162,18 +162,32 @@ static XrmOption xrmOptions[] = {
/* Alias for dmenu compatibility. */
{ xrm_String, "m", { .str = &config.monitor }, NULL,
"Monitor id to show on", CONFIG_DEFAULT },
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
"Margin between rows *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Number, "line-padding", { .num = &config.line_padding }, NULL,
"Padding within rows *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_String, "filter", { .str = &config.filter }, NULL,
"Pre-set filter", CONFIG_DEFAULT },
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
"Separator style (none, dash, solid) *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
"Hide scroll-bar *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
"Fullscreen", CONFIG_DEFAULT },
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
"Fake transparency *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
"DPI", CONFIG_DEFAULT },
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
"Threads to use for string matching", CONFIG_DEFAULT },
{ xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
"Scrollbar width *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
{ xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
"Window Format. w (desktop name), t (title), n (name), r (role), c (class) *DEPRECATED*", CONFIG_DEFAULT },
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,
"Click outside the window to exit", CONFIG_DEFAULT },
{ xrm_Boolean, "show-match", { .snum = &config.show_match }, NULL,