i3: fix reloading for nixos module

By default, i3-msg gets socket from X11 property
which is not available when home manager is running
as nixos module.

This patch changes i3-msg command call by specifying
all i3 sockets found in $XDG_RUNTIME_DIR/i3 folder.

Fixes #252.
This commit is contained in:
Nikita Uvarov 2018-05-25 17:25:49 +02:00
parent 10865f9952
commit 4b388ee902
No known key found for this signature in database
GPG key ID: F7A5FB3A7C10EF96

View file

@ -763,9 +763,10 @@ in
'';
home.activation.reloadI3 = dag.entryAfter [ "linkGeneration" ] ''
if [[ -v i3Changed && -v DISPLAY ]]; then
SOCKET=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*
if [ -v i3Changed ] && [ -S $SOCKET ]; then
echo "Reloading i3"
${cfg.package}/bin/i3-msg reload 1>/dev/null
${cfg.package}/bin/i3-msg -s $SOCKET reload 1>/dev/null
fi
'';
}