From 7a88cdedbda35f808ed2f329a7a811e0511870f9 Mon Sep 17 00:00:00 2001 From: Ujp8LfXBJ6wCPR Date: Thu, 14 Dec 2023 08:04:57 +0100 Subject: [PATCH] hyprland: improve config reload When using the previous approach I've always gotten errors that I can't reload config on the .lock file that exists in /tmp when you run a standard configured hyprland. This commit improves this by using hyprctl to find instances to reload instead. We can remove the HYPRLAND_INSTANCE_SIGNATURE bogus assignment once https://github.com/hyprwm/Hyprland/issues/4088 is resolved. Co-authored-by: Carl Hjerpe --- modules/services/window-managers/hyprland.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/services/window-managers/hyprland.nix b/modules/services/window-managers/hyprland.nix index 3cd3a4b8..ec7fc118 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 ) '';