From 538343be863cb0b9e9f1471e6dc09e0e140c7b3d Mon Sep 17 00:00:00 2001 From: mgurlitz Date: Thu, 5 May 2022 18:29:20 -0700 Subject: [PATCH] Make sway onChange script use cfg.package if set (#2937) --- modules/services/window-managers/i3-sway/sway.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 178ceacd6..f8ad577b9 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -431,12 +431,14 @@ in { home.packages = optional (cfg.package != null) cfg.package ++ optional cfg.xwayland pkgs.xwayland; - xdg.configFile."sway/config" = { + xdg.configFile."sway/config" = let + swayPackage = if cfg.package == null then pkgs.sway else cfg.package; + in { source = configFile; onChange = '' swaySocket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep --uid $UID -x sway || true).sock" if [ -S "$swaySocket" ]; then - ${pkgs.sway}/bin/swaymsg -s $swaySocket reload + ${swayPackage}/bin/swaymsg -s $swaySocket reload fi ''; };