From 95667e60d9024fcaa122ed6096d53f701df11165 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 11 Dec 2016 18:06:35 +0100 Subject: Add theme option to config system. --- config/config.c | 1 + include/settings.h | 2 ++ source/rofi.c | 5 ++--- source/xrmoptions.c | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/config.c b/config/config.c index 5357e339..0c745b7f 100644 --- a/config/config.c +++ b/config/config.c @@ -128,4 +128,5 @@ Settings config = { .window_format = "{w} {c} {t}", .click_to_exit = TRUE, .show_match = TRUE, + .theme = NULL, }; diff --git a/include/settings.h b/include/settings.h index d5f513a5..76f053cf 100644 --- a/include/settings.h +++ b/include/settings.h @@ -149,6 +149,8 @@ typedef struct /** Click outside the window to exit */ int click_to_exit; gboolean show_match; + + char *theme; } Settings; /** Global Settings structure. */ extern Settings config; diff --git a/source/rofi.c b/source/rofi.c index 7fb2d28d..59de85cf 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -898,9 +898,8 @@ int main ( int argc, char *argv[] ) // Parse command line for settings, independent of other -no-config. config_parse_cmd_options_dynamic ( ); - char *theme = NULL; - if ( find_arg_str ( "-theme", &theme ) > 0 ){ - rofi_theme_parse_file ( theme ); + if ( config.theme ) { + rofi_theme_parse_file ( config.theme ); rofi_theme_print ( rofi_theme ); } diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 85a80436..98152b59 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -194,6 +194,8 @@ static XrmOption xrmOptions[] = { "Click outside the window to exit", CONFIG_DEFAULT }, { 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, + "New style theme file" }, }; /** Dynamic array of extra options */ -- cgit v1.2.3