From b5eda7aba85680953dc338a4757b6826713f8c9a Mon Sep 17 00:00:00 2001 From: nullishamy Date: Tue, 28 May 2024 15:32:16 +0100 Subject: [PATCH 1/2] fix: -Dark, not a joke --- build.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.py b/build.py index 2d37d3d6..8a85d53e 100755 --- a/build.py +++ b/build.py @@ -43,6 +43,7 @@ class Suffix: DARK_LIGHT = Suffix( true_value="-Dark", false_value="-Light", test=lambda ctx: ctx.flavor.dark ) +GTK_SUFFIX = Suffix(true_value='-Dark', false_value='-Light', test=lambda ctx: ctx.flavor.dark) @dataclass class BuildContext: @@ -55,10 +56,7 @@ class BuildContext: tweaks: Tweaks def output_dir(self) -> str: - suffix = "light" - if self.flavor.dark: - suffix = "dark" - return f"{self.build_root}/{self.build_id()}-{suffix}" + return f"{self.build_root}/{self.build_id()}{self.apply_suffix(GTK_SUFFIX)}" def build_id(self) -> str: return f"{self.theme_name}-{self.flavor.identifier}-{self.accent.identifier}-{self.size}+{self.tweaks.id() or 'default'}" @@ -80,13 +78,13 @@ def build(ctx: BuildContext): with open(f"{output_dir}/index.theme", "w") as file: file.write("[Desktop Entry]\n") file.write("Type=X-GNOME-Metatheme\n") - file.write(f"Name={ctx.build_id()}\n") + file.write(f"Name={ctx.build_id()}{ctx.apply_suffix(GTK_SUFFIX)}\n") file.write("Comment=An Flat Gtk+ theme based on Elegant Design\n") file.write("Encoding=UTF-8\n") file.write("\n") file.write("[X-GNOME-Metatheme]\n") - file.write(f"GtkTheme={ctx.build_id()}\n") - file.write(f"MetacityTheme={ctx.build_id()}\n") + file.write(f"GtkTheme={ctx.build_id()}{ctx.apply_suffix(GTK_SUFFIX)}\n") + file.write(f"MetacityTheme={ctx.build_id()}{ctx.apply_suffix(GTK_SUFFIX)}\n") file.write(f"IconTheme=Tela-circle{ctx.apply_suffix(IS_DARK)}\n") file.write(f"CursorTheme={ctx.flavor.name}-cursors\n") file.write("ButtonLayout=close,minimize,maximize:menu\n") From 23647dfd106d92a0568bac72317a24f7700697dc Mon Sep 17 00:00:00 2001 From: nullishamy Date: Tue, 28 May 2024 23:16:46 +0100 Subject: [PATCH 2/2] fix: drop casing; absolutely ensure gtk.css and gtk-dark.css are the same --- build.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 8a85d53e..948120f8 100755 --- a/build.py +++ b/build.py @@ -43,7 +43,6 @@ class Suffix: DARK_LIGHT = Suffix( true_value="-Dark", false_value="-Light", test=lambda ctx: ctx.flavor.dark ) -GTK_SUFFIX = Suffix(true_value='-Dark', false_value='-Light', test=lambda ctx: ctx.flavor.dark) @dataclass class BuildContext: @@ -56,7 +55,7 @@ class BuildContext: tweaks: Tweaks def output_dir(self) -> str: - return f"{self.build_root}/{self.build_id()}{self.apply_suffix(GTK_SUFFIX)}" + return f"{self.build_root}/{self.build_id()}" def build_id(self) -> str: return f"{self.theme_name}-{self.flavor.identifier}-{self.accent.identifier}-{self.size}+{self.tweaks.id() or 'default'}" @@ -78,13 +77,13 @@ def build(ctx: BuildContext): with open(f"{output_dir}/index.theme", "w") as file: file.write("[Desktop Entry]\n") file.write("Type=X-GNOME-Metatheme\n") - file.write(f"Name={ctx.build_id()}{ctx.apply_suffix(GTK_SUFFIX)}\n") + file.write(f"Name={ctx.build_id()}\n") file.write("Comment=An Flat Gtk+ theme based on Elegant Design\n") file.write("Encoding=UTF-8\n") file.write("\n") file.write("[X-GNOME-Metatheme]\n") - file.write(f"GtkTheme={ctx.build_id()}{ctx.apply_suffix(GTK_SUFFIX)}\n") - file.write(f"MetacityTheme={ctx.build_id()}{ctx.apply_suffix(GTK_SUFFIX)}\n") + file.write(f"GtkTheme={ctx.build_id()}\n") + file.write(f"MetacityTheme={ctx.build_id()}\n") file.write(f"IconTheme=Tela-circle{ctx.apply_suffix(IS_DARK)}\n") file.write(f"CursorTheme={ctx.flavor.name}-cursors\n") file.write("ButtonLayout=close,minimize,maximize:menu\n") @@ -116,8 +115,7 @@ def build(ctx: BuildContext): [ "sassc", *SASSC_OPT, - # NOTE: This uses 'Dark' for the source, but 'dark' for the destination. This is intentional. Do !!NOT!! change it without consultation - f"{SRC_DIR}/main/gtk-3.0/gtk-Dark.scss", + f"{SRC_DIR}/main/gtk-3.0/gtk{ctx.apply_suffix(DARK_LIGHT)}.scss", f"{output_dir}/gtk-3.0/gtk-dark.css", ] ) @@ -135,8 +133,7 @@ def build(ctx: BuildContext): [ "sassc", *SASSC_OPT, - # NOTE: This uses 'Dark' for the source, but 'dark' for the destination. This is intentional. Do !!NOT!! change it without consultation - f"{SRC_DIR}/main/gtk-4.0/gtk-Dark.scss", + f"{SRC_DIR}/main/gtk-4.0/gtk{ctx.apply_suffix(DARK_LIGHT)}.scss", f"{output_dir}/gtk-4.0/gtk-dark.css", ] )