[nix] Add helper script to suspend only if it's the side computer
This commit is contained in:
parent
bf3f94ae05
commit
0f88434da3
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SWAYSOCK=/run/user/$(id -u)/sway-ipc.sock
|
||||||
|
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"
|
||||||
|
export SWAYSOCK
|
||||||
|
export DBUS_SESSION_BUS_ADDRESS
|
||||||
|
|
||||||
|
if swaymsg -t get_inputs | grep "Planck EZ"; then
|
||||||
|
doas /run/current-system/sw/bin/systemctl suspend;
|
||||||
|
fi;
|
|
@ -416,6 +416,7 @@ in
|
||||||
unlock '${config.home.homeDirectory}/bin/thinkpad-dock' \
|
unlock '${config.home.homeDirectory}/bin/thinkpad-dock' \
|
||||||
timeout 300 '${config.home.homeDirectory}/bin/blur-lock' \
|
timeout 300 '${config.home.homeDirectory}/bin/blur-lock' \
|
||||||
timeout 600 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \
|
timeout 600 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \
|
||||||
|
timeout 900 '${config.home.homeDirectory}/bin/suspend-if-docked' \
|
||||||
resume '${pkgs.sway}/bin/swaymsg "output * dpms on"'
|
resume '${pkgs.sway}/bin/swaymsg "output * dpms on"'
|
||||||
'';
|
'';
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
Loading…
Reference in New Issue