1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

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,19 +111,29 @@ Settings config = {
.matching_method = MM_NORMAL,
/** Monitor */
.monitor = "-5",
/** set line margin */
.line_margin = 2,
.line_padding = 1,
/** Set filter */
.filter = NULL,
.fullscreen = FALSE,
.dpi = -1,
.threads = 0,
.scroll_method = 0,
.window_format = "{w} {i}{c} {t}",
.click_to_exit = TRUE,
.show_match = TRUE,
.theme = NULL,
.color_normal = NULL,
.color_active = NULL,
.color_urgent = NULL,
.color_window = NULL,
.plugin_path = PLUGIN_PATH,
.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,
.theme = NULL,
.color_normal = NULL,
.color_active = NULL,
.color_urgent = NULL,
.color_window = NULL,
.plugin_path = PLUGIN_PATH,
};

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

@ -81,114 +81,128 @@ typedef struct
* Currently supports string, boolean and number (signed and unsigned).
*/
static XrmOption xrmOptions[] = {
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
"", CONFIG_DEFAULT },
{ xrm_String, "modi", { .str = &config.modi }, NULL,
{ xrm_String, "modi", { .str = &config.modi }, NULL,
"Enabled modi", CONFIG_DEFAULT },
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
"Window width", CONFIG_DEFAULT },
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
"Number of lines", CONFIG_DEFAULT },
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
"Number of columns", CONFIG_DEFAULT },
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
"Font to use", CONFIG_DEFAULT },
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
"", CONFIG_DEFAULT },
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
"Border width", CONFIG_DEFAULT },
{ xrm_Number, "location", { .num = &config.location }, NULL,
{ xrm_Number, "location", { .num = &config.location }, NULL,
"Location on screen", CONFIG_DEFAULT },
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
"Padding", CONFIG_DEFAULT },
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
"Y-offset relative to location", CONFIG_DEFAULT },
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
"X-offset relative to location", CONFIG_DEFAULT },
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
"Always show number of lines", CONFIG_DEFAULT },
{ xrm_Boolean, "show-icons", { .snum = &config.show_icons }, NULL,
{ xrm_Boolean, "show-icons", { .snum = &config.show_icons }, NULL,
"Whether to load and show icons", CONFIG_DEFAULT },
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
"Terminal to use", CONFIG_DEFAULT },
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
"Ssh client to use", CONFIG_DEFAULT },
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
"Ssh command to execute", CONFIG_DEFAULT },
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
"Run command to execute", CONFIG_DEFAULT },
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
"Command to get extra run targets", CONFIG_DEFAULT },
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
"Run command to execute that runs in shell", CONFIG_DEFAULT },
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
{ xrm_String, "drun-icon-theme", { .str = &config.drun_icon_theme }, NULL,
{ xrm_String, "drun-icon-theme", { .str = &config.drun_icon_theme }, NULL,
"Theme to use to look for icons", CONFIG_DEFAULT },
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
"Disable history in run/ssh", CONFIG_DEFAULT },
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
{ xrm_Boolean, "sort", { .num = &config.sort }, NULL,
"Use sorting", CONFIG_DEFAULT },
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
"Use levenshtein sorting also for fuzzy matching", CONFIG_DEFAULT },
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
"Set case-sensitivity", CONFIG_DEFAULT },
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
"Cycle through the results list", CONFIG_DEFAULT },
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
"Enable sidebar-mode", CONFIG_DEFAULT },
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
"Row height (in chars)", CONFIG_DEFAULT },
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
"Enable auto select mode", CONFIG_DEFAULT },
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
{ xrm_String, "matching", { .str = &config.matching }, NULL,
{ xrm_String, "matching", { .str = &config.matching }, NULL,
"Set the matching algorithm. (normal, regex, glob, fuzzy)", CONFIG_DEFAULT },
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
"Tokenize input string", CONFIG_DEFAULT },
{ xrm_String, "monitor", { .str = &config.monitor }, NULL,
{ xrm_String, "monitor", { .str = &config.monitor }, NULL,
"", CONFIG_DEFAULT },
/* Alias for dmenu compatibility. */
{ xrm_String, "m", { .str = &config.monitor }, NULL,
{ xrm_String, "m", { .str = &config.monitor }, NULL,
"Monitor id to show on", CONFIG_DEFAULT },
{ xrm_String, "filter", { .str = &config.filter }, NULL,
{ 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_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
{ 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_SNumber, "dpi", { .snum = &config.dpi }, NULL,
{ 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,
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
"Threads to use for string matching", CONFIG_DEFAULT },
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
{ 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, "window-format", { .str = &config.window_format }, NULL,
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
{ xrm_Boolean, "click-to-exit", { .snum = &config.click_to_exit }, NULL,
{ 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) *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,
{ xrm_Boolean, "show-match", { .snum = &config.show_match }, NULL,
"Indicate how it match by underlining it.", CONFIG_DEFAULT },
{ xrm_String, "theme", { .str = &config.theme }, NULL,
{ xrm_String, "theme", { .str = &config.theme }, NULL,
"New style theme file", CONFIG_DEFAULT },
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
"Color scheme for normal row", CONFIG_DEFAULT },
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
"Color scheme for urgent row", CONFIG_DEFAULT },
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
"Color scheme for active row", CONFIG_DEFAULT },
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
"Color scheme window", CONFIG_DEFAULT },
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
"Directory containing plugins", CONFIG_DEFAULT },
};