diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 3cd3a4b80..ec7fc118d 100644 --- a/modules/services/window-managers/hyprland.nix +++ b/modules/services/window-managers/hyprland.nix @@ -243,11 +243,11 @@ in { + lib.optionalString (cfg.extraConfig != "") cfg.extraConfig; onChange = lib.mkIf (cfg.package != null) '' - ( # 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##*/} ${cfg.finalPackage}/bin/hyprctl reload config-only \ - || true # ignore dead instance(s) + ( # Execute in subshell so we don't poision environment with vars + # This var must be set for hyprctl to function, but the value doesn't matter. + export HYPRLAND_INSTANCE_SIGNATURE="bogus" + for i in $(${cfg.finalPackage}/bin/hyprctl instances -j | jq ".[].instance" -r); do + HYPRLAND_INSTANCE_SIGNATURE=$i ${cfg.finalPackage}/bin/hyprctl reload config-only done ) '';