diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-03-27 09:04:55 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-03-27 09:04:55 +0200 |
commit | b91a9fb0c0d08950aa4556c4a7e9ad0870a1cdab (patch) | |
tree | c42295027485464ce44244b7bddca59363de67d0 /lexer/theme-parser.y | |
parent | 5186dab1b848d97aa12ae64b4f424371f91cec9c (diff) |
Add 'Configuration' section to rasi format that parses config option.
Diffstat (limited to 'lexer/theme-parser.y')
-rw-r--r-- | lexer/theme-parser.y | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index e304ff29..f571d231 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -89,6 +89,7 @@ int yylex (YYSTYPE *, YYLTYPE *); %token NAME_PREFIX "Element section ('# {name} { ... }')" %token WHITESPACE "White space" %token PDEFAULTS "Default settings section ( '* { ... }')" +%token CONFIGURATION "Configuration block" %type <ival> highlight_styles %type <sval> entry @@ -131,6 +132,32 @@ NAME_PREFIX name_path BOPEN optional_properties BCLOSE PDEFAULTS BOPEN optional_properties BCLOSE { rofi_theme_widget_add_properties ( rofi_theme, $3); } +| CONFIGURATION BOPEN optional_properties BCLOSE { + GHashTableIter iter; + g_hash_table_iter_init ( &iter, $3 ); + gpointer key,value; + while ( g_hash_table_iter_next ( &iter, &key, &value ) ) { + Property *p = (Property *) value; + switch ( p ->type ) + { + case P_STRING: + config_parser_set_option ( p->name, p->value.s); + break; + case P_BOOLEAN: + config_parser_set_option ( p->name, p->value.b?"true":"false"); + break; + case P_INTEGER: + { + char *str = g_strdup_printf("%d", p->value.i); + config_parser_set_option ( p->name, str ); + g_free(str); + } + default: + break; + + } + } +} ; /** |