kvantum scripts: use xdg dirs instead of assuming defaults

This commit is contained in:
end-4
2025-02-03 15:56:41 +01:00
parent e8d2ef96b7
commit 3eeb6c6f82
3 changed files with 18 additions and 9 deletions
+6 -3
View File
@@ -35,9 +35,12 @@ def update_svg_colors(svg_path, old_to_new_colors, output_path):
print(f"SVG colors have been updated and saved to {output_path}!")
def main():
scss_file = os.path.expanduser('~/.local/state/ags/scss/_material.scss') # Hardcoded path to the SCSS file
svg_path = os.path.expanduser('~/.config/Kvantum/Colloid/Colloid.svg') # Hardcoded path to the input SVG file
output_path = os.path.expanduser('~/.config/Kvantum/MaterialAdw/MaterialAdw.svg') # Hardcoded path to the output SVG file
xdg_config_home = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
xdg_state_home = os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))
scss_file = os.path.join(xdg_state_home, "ags", "scss", "_material.scss")
svg_path = os.path.join(xdg_config_home, "Kvantum", "Colloid", "Colloid.svg")
output_path = os.path.join(xdg_config_home, "Kvantum", "MaterialAdw", "MaterialAdw.svg")
# Read colors from the SCSS file
color_data = read_scss(scss_file)
+6 -3
View File
@@ -35,9 +35,12 @@ def update_svg_colors(svg_path, old_to_new_colors, output_path):
print(f"SVG colors have been updated and saved to {output_path}!")
def main():
scss_file = os.path.expanduser('~/.local/state/ags/scss/_material.scss') # Hardcoded path to the SCSS file
svg_path = os.path.expanduser('~/.config/Kvantum/Colloid/ColloidDark.svg') # Hardcoded path to the input SVG file
output_path = os.path.expanduser('~/.config/Kvantum/MaterialAdw/MaterialAdw.svg') # Hardcoded path to the output SVG file
xdg_config_home = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
xdg_state_home = os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))
scss_file = os.path.join(xdg_state_home, "ags", "scss", "_material.scss")
svg_path = os.path.join(xdg_config_home, "Kvantum", "Colloid", "ColloidDark.svg")
output_path = os.path.join(xdg_config_home, "Kvantum", "MaterialAdw", "MaterialAdw.svg")
# Read colors from the SCSS file
color_data = read_scss(scss_file)
@@ -28,9 +28,12 @@ def update_config_colors(config_file, colors, mappings):
file.write(config_content)
if __name__ == "__main__":
scss_file = os.path.expanduser('~/.local/state/ags/scss/_material.scss')
config_file = os.path.expanduser('~/.config/Kvantum/MaterialAdw/MaterialAdw.kvconfig') # Replace with the actual path to your config file
xdg_config_home = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
xdg_state_home = os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))
config_file = os.path.join(xdg_config_home, "Kvantum", "MaterialAdw", "MaterialAdw.kvconfig")
scss_file = os.path.join(xdg_state_home, "ags", "scss", "_material.scss")
# Define your mappings here
mappings = {
'window.color': 'background',