From ba0acd625fecfb2aa823a748b295655e3a664ce0 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 31 Oct 2017 19:29:27 +0100 Subject: [PATCH 1/2] Remove leading # from dump theme and add mesg about rofi dumping it --- doc/default_theme.rasi | 49 ++++++++++++++++--------------- doc/old-theme-convert-output.rasi | 49 ++++++++++++++++--------------- source/theme.c | 8 ++--- test/convert_old_theme_test.sh | 2 +- test/default_theme_test.sh | 2 +- 5 files changed, 58 insertions(+), 52 deletions(-) diff --git a/doc/default_theme.rasi b/doc/default_theme.rasi index fd9d0549..ebf9bbbb 100644 --- a/doc/default_theme.rasi +++ b/doc/default_theme.rasi @@ -1,3 +1,6 @@ +/** + * rofi -dump-theme output. + **/ * { selected-normal-foreground: @lightbg; foreground: rgba ( 0, 43, 54, 100 % ); @@ -28,24 +31,24 @@ active-background: @background; selected-active-background: @blue; } -#window { +window { background-color: @background; border: 1; padding: 5; } -#mainbox { +mainbox { border: 0; padding: 0; } -#message { +message { border: 2px dash 0px 0px ; border-color: @separatorcolor; padding: 1px ; } -#textbox { +textbox { text-color: @foreground; } -#listview { +listview { fixed-height: 0; border: 2px dash 0px 0px ; border-color: @separatorcolor; @@ -53,79 +56,79 @@ scrollbar: true; padding: 2px 0px 0px ; } -#element { +element { border: 0; padding: 1px ; } -#element.normal.normal { +element normal.normal { background-color: @normal-background; text-color: @normal-foreground; } -#element.normal.urgent { +element normal.urgent { background-color: @urgent-background; text-color: @urgent-foreground; } -#element.normal.active { +element normal.active { background-color: @active-background; text-color: @active-foreground; } -#element.selected.normal { +element selected.normal { background-color: @selected-normal-background; text-color: @selected-normal-foreground; } -#element.selected.urgent { +element selected.urgent { background-color: @selected-urgent-background; text-color: @selected-urgent-foreground; } -#element.selected.active { +element selected.active { background-color: @selected-active-background; text-color: @selected-active-foreground; } -#element.alternate.normal { +element alternate.normal { background-color: @alternate-normal-background; text-color: @alternate-normal-foreground; } -#element.alternate.urgent { +element alternate.urgent { background-color: @alternate-urgent-background; text-color: @alternate-urgent-foreground; } -#element.alternate.active { +element alternate.active { background-color: @alternate-active-background; text-color: @alternate-active-foreground; } -#scrollbar { +scrollbar { width: 4px ; border: 0; handle-color: @normal-foreground; handle-width: 8px ; padding: 0; } -#sidebar { +sidebar { border: 2px dash 0px 0px ; border-color: @separatorcolor; } -#button { +button { spacing: 0; text-color: @normal-foreground; } -#button.selected { +button selected { background-color: @selected-normal-background; text-color: @selected-normal-foreground; } -#inputbar { +inputbar { spacing: 3px ; text-color: @normal-foreground; padding: 1px ; } -#case-indicator { +case-indicator { spacing: 0; text-color: @normal-foreground; } -#entry { +entry { spacing: 0; text-color: @normal-foreground; } -#prompt { +prompt { spacing: 0; text-color: @normal-foreground; } diff --git a/doc/old-theme-convert-output.rasi b/doc/old-theme-convert-output.rasi index 18bfa179..fb2c578d 100644 --- a/doc/old-theme-convert-output.rasi +++ b/doc/old-theme-convert-output.rasi @@ -1,3 +1,6 @@ +/** + * rofi -dump-theme output. + **/ * { selected-normal-foreground: rgba ( 2, 20, 63, 100 % ); foreground: rgba ( 219, 223, 188, 100 % ); @@ -28,24 +31,24 @@ active-background: rgba ( 0, 0, 0, 0 % ); selected-active-background: rgba ( 138, 196, 255, 100 % ); } -#window { +window { background-color: @background; border: 1; padding: 5; } -#mainbox { +mainbox { border: 0; padding: 0; } -#message { +message { border: 2px 0px 0px ; border-color: @separatorcolor; padding: 1px ; } -#textbox { +textbox { text-color: @foreground; } -#listview { +listview { fixed-height: 0; border: 2px 0px 0px ; border-color: @separatorcolor; @@ -53,79 +56,79 @@ scrollbar: true; padding: 2px 0px 0px ; } -#element { +element { border: 0; padding: 1px ; } -#element.normal.normal { +element normal.normal { background-color: @normal-background; text-color: @normal-foreground; } -#element.normal.urgent { +element normal.urgent { background-color: @urgent-background; text-color: @urgent-foreground; } -#element.normal.active { +element normal.active { background-color: @active-background; text-color: @active-foreground; } -#element.selected.normal { +element selected.normal { background-color: @selected-normal-background; text-color: @selected-normal-foreground; } -#element.selected.urgent { +element selected.urgent { background-color: @selected-urgent-background; text-color: @selected-urgent-foreground; } -#element.selected.active { +element selected.active { background-color: @selected-active-background; text-color: @selected-active-foreground; } -#element.alternate.normal { +element alternate.normal { background-color: @alternate-normal-background; text-color: @alternate-normal-foreground; } -#element.alternate.urgent { +element alternate.urgent { background-color: @alternate-urgent-background; text-color: @alternate-urgent-foreground; } -#element.alternate.active { +element alternate.active { background-color: @alternate-active-background; text-color: @alternate-active-foreground; } -#scrollbar { +scrollbar { width: 4px ; border: 0; handle-color: @normal-foreground; handle-width: 8px ; padding: 0; } -#sidebar { +sidebar { border: 2px 0px 0px ; border-color: @separatorcolor; } -#button { +button { spacing: 0; text-color: @normal-foreground; } -#button.selected { +button selected { background-color: @selected-normal-background; text-color: @selected-normal-foreground; } -#inputbar { +inputbar { spacing: 3px ; text-color: @normal-foreground; padding: 1px ; } -#case-indicator { +case-indicator { spacing: 0; text-color: @normal-foreground; } -#entry { +entry { spacing: 0; text-color: @normal-foreground; } -#prompt { +prompt { spacing: 0; text-color: @normal-foreground; } diff --git a/source/theme.c b/source/theme.c index 42c5c270..a45e8ee2 100644 --- a/source/theme.c +++ b/source/theme.c @@ -286,11 +286,10 @@ static void rofi_theme_print_index ( ThemeWidget *widget ) index = 4; for ( GList *iter = g_list_first ( list ); iter != NULL; iter = g_list_next ( iter ) ) { char *name = (char *) iter->data; - if ( iter->prev == NULL ) { - putchar ( '#' ); - } fputs ( name, stdout ); - if ( iter->next ) { + if ( iter->prev == NULL && iter->next ) { + putchar ( ' ' ); + } else if ( iter->next ) { putchar ( '.' ); } } @@ -321,6 +320,7 @@ static void rofi_theme_print_index ( ThemeWidget *widget ) void rofi_theme_print ( ThemeWidget *widget ) { if ( widget != NULL ) { + printf("/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", VERSION); rofi_theme_print_index ( widget ); } } diff --git a/test/convert_old_theme_test.sh b/test/convert_old_theme_test.sh index 75fc392b..52bbc6a7 100755 --- a/test/convert_old_theme_test.sh +++ b/test/convert_old_theme_test.sh @@ -3,7 +3,7 @@ TOP_DIR=$1 xrdb -retain -load ${TOP_DIR}/doc/old-theme-convert-input.theme -rofi -config ${TOP_DIR}/doc/old-theme-convert-input.theme -dump-theme > temp.txt +rofi -config ${TOP_DIR}/doc/old-theme-convert-input.theme -dump-theme | grep -v "Rofi version" > temp.txt if ! diff temp.txt ${TOP_DIR}/doc/old-theme-convert-output.rasi > /dev/null then diff --git a/test/default_theme_test.sh b/test/default_theme_test.sh index 8baa66c9..7e497686 100755 --- a/test/default_theme_test.sh +++ b/test/default_theme_test.sh @@ -2,7 +2,7 @@ TOP_DIR=$1 -rofi -no-config -dump-theme > temp.txt +rofi -no-config -dump-theme | grep -v "Rofi version" > temp.txt if ! diff temp.txt ${TOP_DIR}/doc/default_theme.rasi > /dev/null then From 0ef2ad0771e003f1170368703d988664a943f12f Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 31 Oct 2017 19:36:13 +0100 Subject: [PATCH 2/2] Use PACKAGE_VERSION as it is known to both make and meson. --- source/theme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/theme.c b/source/theme.c index a45e8ee2..e0a5dfbb 100644 --- a/source/theme.c +++ b/source/theme.c @@ -320,7 +320,7 @@ static void rofi_theme_print_index ( ThemeWidget *widget ) void rofi_theme_print ( ThemeWidget *widget ) { if ( widget != NULL ) { - printf("/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", VERSION); + printf("/**\n * rofi -dump-theme output.\n * Rofi version: %s\n **/\n", PACKAGE_VERSION); rofi_theme_print_index ( widget ); } }