From f49b5f1255fec09180e390a18ded76ff1dede2de Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:57:08 -0700 Subject: [PATCH] Update .chezmoi.toml Update .chezmoiscripts/drapeau.py --- .chezmoi.toml.tmpl | 2 +- .chezmoiscripts/run_drapeau.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index 9544444..b8f2b6d 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -7,4 +7,4 @@ autoPush = true gpgKey = {{ output "get-gpg-key" | trim | quote }} [data.drapeau] -colorscheme = 'catppuccin-macchiato.toml' +colorscheme = 'catppuccin-macchiato' diff --git a/.chezmoiscripts/run_drapeau.py b/.chezmoiscripts/run_drapeau.py index 1f3efa5..8863124 100644 --- a/.chezmoiscripts/run_drapeau.py +++ b/.chezmoiscripts/run_drapeau.py @@ -1,6 +1,8 @@ #!/usr/bin/python import os import toml +from pprint import pprint + def main(): # Chech if config file exists @@ -28,20 +30,28 @@ def main(): # Produce dict of {"name": "path"} for all schemes drapeau_config_dir = os.path.join(os.environ["HOME"], ".config", "drapeau") if os.path.exists(drapeau_config_dir): - drapeau_color_scheme_files = {".".join(scheme.split(".")[:-1]): os.path.join(drapeau_config_dir, scheme) for scheme in os.listdir(drapeau_config_dir) if os.path.isfile(os.path.join(drapeau_config_dir, scheme))} + drapeau_color_scheme_files = { + ".".join(scheme.split(".")[:-1]): os.path.join(drapeau_config_dir, scheme) + for scheme in os.listdir(drapeau_config_dir) + if os.path.isfile(os.path.join(drapeau_config_dir, scheme)) + } else: drapeau_color_scheme_files = {} + pprint(drapeau_color_scheme_files) # Extract colorscheme data from desired scheme - drapeau_color_scheme_dict = toml.load(drapeau_color_scheme_files[drapeau_color_scheme]) + drapeau_color_scheme_dict = toml.load( + drapeau_color_scheme_files[drapeau_color_scheme] + ) # Add colorscheme to chezmoi config data chezmoi_config_dict["data"]["drapeau"]["colors"] = drapeau_color_scheme_dict # Write out modified dict to chezmoi config file - with open(chezmoi_config_file, 'w') as f: + with open(chezmoi_config_file, "w") as f: toml.dump(chezmoi_config_dict, f) return "=== SUCCESS ===" + main()