diff --git a/bar.nix b/bar.nix index fcb81b4..3df241b 100644 --- a/bar.nix +++ b/bar.nix @@ -260,9 +260,9 @@ }; "custom/loopback" = lib.attrsets.optionalAttrs (variant == "default") { - exec = "if systemctl --user is-active --quiet loopback; then echo oui; else echo non; fi"; + exec = "journalctl --user -f -u loopback | exec_on_stdin_newline 'if systemctl --user is-active --quiet loopback; then echo loopback ON; else echo loopback; fi'"; on-click = "if systemctl --user is-active --quiet loopback; then systemctl --user stop loopback; else systemctl --user start loopback; fi"; - format = "TEST {}"; + format = "{}"; }; "hyprland/submap" = { diff --git a/home.nix b/home.nix index c49e645..1c8b1cf 100644 --- a/home.nix +++ b/home.nix @@ -50,6 +50,14 @@ echo "$cwd" ''; + ".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} '' + # run command whjen a newline is added to stdin + import subprocess + from sys import stdin, argv + cmd = argv[1:] + while stdin.readline(): + subprocess.call(cmd, shell=True) + ''; ".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs;