summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2021-09-08 13:30:43 +0200
committerDave Davenport <qball@blame.services>2021-09-08 13:30:43 +0200
commite5363ab22e30382eb853a0cf7b1816f0afdcd705 (patch)
tree47a7f246b50a04b613161d8602802a38ed415c1d
parentfe87ccdfb18fb53657e5bfb2163993f00924024f (diff)
[I1442] Support merging down default block.i1442
Issue: #1442
-rw-r--r--lexer/theme-parser.y3
-rw-r--r--source/rofi.c6
-rw-r--r--source/theme.c5
3 files changed, 12 insertions, 2 deletions
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index cdef6421..41b3e0db 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -376,7 +376,8 @@ t_entry_list:
g_list_free ( $3 );
}
| t_entry_list T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE {
- rofi_theme_widget_add_properties ( $1, $4);
+ ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, "*" );
+ rofi_theme_widget_add_properties (widget, $4);
if ( $4 ) {
g_hash_table_destroy ( $4 );
}
diff --git a/source/rofi.c b/source/rofi.c
index a0595fa5..deed3439 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -1009,6 +1009,12 @@ int main(int argc, char *argv[]) {
cleanup();
return EXIT_SUCCESS;
}
+ if (find_arg("-dump-processed-theme") >= 0) {
+ rofi_theme_parse_process_conditionals();
+ rofi_theme_print(rofi_theme);
+ cleanup();
+ return EXIT_SUCCESS;
+ }
if (find_arg("-dump-config") >= 0) {
config_parse_dump_config_rasi_format(stdout, FALSE);
cleanup();
diff --git a/source/theme.c b/source/theme.c
index d2e03fd9..66da7bb9 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -1379,8 +1379,11 @@ static void rofi_theme_parse_process_conditionals_int(workarea mon,
while (i < rwidget->num_widgets) {
ThemeWidget *widget = rwidget->widgets[i];
if (widget->media != NULL) {
- rwidget->widgets[i] = rwidget->widgets[rwidget->num_widgets - 1];
rwidget->num_widgets--;
+ for (unsigned x = i; x < rwidget->num_widgets; x++) {
+ rwidget->widgets[x] = rwidget->widgets[x + 1];
+ }
+ rwidget->widgets[rwidget->num_widgets] = NULL;
switch (widget->media->type) {
case THEME_MEDIA_TYPE_MIN_WIDTH: {
int w = widget->media->value;