sway: fix onChange for sway config when sway isn't running (#1506)
`pgrep -x somecommand` exits with a non-zero status if it finds no process running with the given name. When using home-manager as a NixOS module, on boot (when sway isn't running) this script would fail and then fail the unit since it seems the onChange scripts are running with the -e switch. This change ensures we're always returning a 0 exit status where we attempt to get the pid of sway - we're only interested in either the pid or an empty string, the exit status isn't important.
This commit is contained in:
parent
a6a3abb295
commit
8a160f01ab
|
@ -396,7 +396,7 @@ in {
|
||||||
xdg.configFile."sway/config" = {
|
xdg.configFile."sway/config" = {
|
||||||
source = configFile;
|
source = configFile;
|
||||||
onChange = ''
|
onChange = ''
|
||||||
swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway).sock
|
swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway || ${pkgs.coreutils}/bin/true).sock
|
||||||
if [ -S $swaySocket ]; then
|
if [ -S $swaySocket ]; then
|
||||||
echo "Reloading sway"
|
echo "Reloading sway"
|
||||||
$DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload
|
$DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload
|
||||||
|
|
Loading…
Reference in a new issue