diff options
author | Dave Davenport <qball@blame.services> | 2021-06-14 19:29:05 +0200 |
---|---|---|
committer | Dave Davenport <qball@blame.services> | 2021-06-14 19:29:05 +0200 |
commit | 0f21541327418e7aaa99a8192eb79ed9c6438b88 (patch) | |
tree | cda6a54d5ee059c796fcb7b24ab1abb9bc706bc5 /source | |
parent | 828aaa231a84f9ad23cf836a71b58290b5e217e8 (diff) |
[Configuration] Add start of more 'theme' based configuration.
Nested CSS blocks in configuration {} are parsed into
rofi_configuration.
Diffstat (limited to 'source')
-rw-r--r-- | source/dialogs/combi.c | 2 | ||||
-rw-r--r-- | source/rofi.c | 5 | ||||
-rw-r--r-- | source/theme.c | 8 | ||||
-rw-r--r-- | source/xrmoptions.c | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index 552ab36d..231b7f0f 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -223,7 +223,7 @@ static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *stat } if ( attr_list != NULL ) { - ThemeWidget *wid = rofi_theme_find_widget ( sw->name, NULL, TRUE ); + ThemeWidget *wid = rofi_config_find_widget ( sw->name, NULL, TRUE ); Property *p = rofi_theme_find_property ( wid, P_COLOR, pd->switchers[i].mode->name, TRUE ); if ( p != NULL ) { PangoAttribute *pa = pango_attr_foreground_new ( diff --git a/source/rofi.c b/source/rofi.c index 202ff378..b2e62805 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -472,6 +472,11 @@ static void cleanup () TIMINGS_STOP (); rofi_collect_modi_destroy ( ); rofi_icon_fetcher_destroy ( ); + + if ( rofi_configuration ) { + rofi_theme_free ( rofi_configuration ); + rofi_configuration = NULL; + } } /** diff --git a/source/theme.c b/source/theme.c index f70f0c45..fa8ac220 100644 --- a/source/theme.c +++ b/source/theme.c @@ -798,6 +798,14 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con } return NULL; } +ThemeWidget *rofi_config_find_widget ( const char *name, const char *state, gboolean exact ) +{ + // First find exact match based on name. + ThemeWidget *widget = rofi_theme_find_single ( rofi_configuration, name ); + widget = rofi_theme_find ( widget, state, exact ); + + return widget; +} ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gboolean exact ) { // First find exact match based on name. diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 6eb03c62..6b5226bc 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -44,6 +44,8 @@ #include "rofi-types.h" +ThemeWidget *rofi_configuration = NULL; + /** Different sources of configuration. */ const char * const ConfigSourceStr[] = { |