Make sway onChange script use cfg.package if set (#2937)

This commit is contained in:
mgurlitz 2022-05-05 18:29:20 -07:00 committed by GitHub
parent 4036f1a751
commit 538343be86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
'';
};