From 6f025b38253ae14f38b366c37d8e568a2f8e67b3 Mon Sep 17 00:00:00 2001 From: Nathan Typanski Date: Sun, 24 Apr 2022 17:38:50 -0400 Subject: [PATCH] i3-sway: only return current user's socket (#2914) Constrain the pgrep command to only return results for the current user. Additionally, quote the socket variables to prevent splitting. Previously, if multiple users on a system were running `sway`, the `pgrep` used in finding `swaySocket` would return multiple results. As a result, reloads of sway would fail. Fixes #2912. --- modules/services/window-managers/i3-sway/sway.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index a3f119ad..178ceacd 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -434,8 +434,8 @@ in { xdg.configFile."sway/config" = { source = configFile; onChange = '' - swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway || true).sock - if [ -S $swaySocket ]; then + 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 fi '';