diff options
| author | Gaoyang Zhang <gy@blurgy.xyz> | 2022-12-21 15:58:44 +0800 |
|---|---|---|
| committer | Mihai Fufezan <fufexan@pm.me> | 2022-12-22 00:07:38 +0200 |
| commit | 8a23b66c3975285ac5df75e76e50615eba056b8a (patch) | |
| tree | b3a3a53ea58a0b2a50ea04a362b1f75367f3efe0 | |
| parent | de5e784e0759d62f0973fcb7a0e6461524e220f4 (diff) | |
nix: handle reloading of multiple/dead instances on home manager generation switch
Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
| -rw-r--r-- | nix/hm-module.nix | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 4109fe54..fc9f6842 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -133,7 +133,13 @@ in { then defaultHyprlandPackage else cfg.package; in - lib.mkIf (!cfg.disableAutoreload) "HYPRLAND_INSTANCE_SIGNATURE=$(ls -w 1 /tmp/hypr | tail -1) ${hyprlandPackage}/bin/hyprctl reload config-only"; + lib.mkIf (!cfg.disableAutoreload) ''( # execute in subshell so that `shopt` won't affect other scripts + shopt -s nullglob # so that nothing is done if /tmp/hypr/ does not exist or is empty + for instance in /tmp/hypr/*; do + HYPRLAND_INSTANCE_SIGNATURE=''${instance##*/} ${hyprlandPackage}/bin/hyprctl reload config-only \ + || true # ignore dead instance(s) + done + )''; }; systemd.user.targets.hyprland-session = lib.mkIf cfg.systemdIntegration { |
