Add waybar reload hook

This commit is contained in:
Adam Gausmann 2025-02-08 09:34:39 -06:00
parent d180eaa72e
commit c632e4d9c3

View file

@ -215,10 +215,11 @@ def main():
)
args = parser.parse_args()
raw_dir = args.dotfiles / "raw"
templates_dir = args.dotfiles / "templates"
include_dir = args.dotfiles / "include"
host_filename = args.dotfiles / "hosts" / "{}.toml".format(args.hostname)
dotfiles_dir: Path = args.dotfiles
raw_dir = dotfiles_dir / "raw"
templates_dir = dotfiles_dir / "templates"
include_dir = dotfiles_dir / "include"
host_filename = dotfiles_dir / "hosts" / "{}.toml".format(args.hostname)
host_toml = {
"name": args.hostname,
@ -277,6 +278,8 @@ def main():
],
)
changed_paths = set()
for raw_path in raw_dir.glob("**/*"):
if not raw_path.is_file():
continue
@ -287,6 +290,7 @@ def main():
print(rel_path)
output_path.parent.mkdir(parents=True, exist_ok=True)
shutil.copy(raw_path, output_path)
changed_paths.update(map(str, rel_path.parents))
for template_path in templates_dir.glob("**/*"):
if not template_path.is_file():
@ -312,6 +316,11 @@ def main():
# Copy permissions from original file
output_path.chmod(template_path.stat().st_mode & 0o777)
changed_paths.update(map(str, rel_path.parents))
# Post-install hooks
if ".config/waybar" in changed_paths:
subprocess.call(["killall", "-USR2", "waybar"])
if __name__ == "__main__":