1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-27 12:19:48 +01:00

i3: fix reloading when there are several sockets

This can happen after logout/login.

Fixes #527
This commit is contained in:
Guillaume Girol 2022-11-05 12:00:00 +00:00 committed by Robert Helgesson
parent 989d4fa536
commit c5adf29545
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -249,10 +249,13 @@ in {
xdg.configFile."i3/config" = {
source = checkI3Config;
onChange = ''
i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*
if [ -S $i3Socket ]; then
${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null
fi
# There may be several sockets after log out/log in, but the old ones
# will fail with "Connection refused".
for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do
if [[ -S $i3Socket ]]; then
${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true
fi
done
'';
};
}