1
0
Fork 0

[nix] Add helper script to suspend only if it's the side computer

main
Sebastian Schulze 2022-10-20 10:54:08 +02:00
parent bf3f94ae05
commit 0f88434da3
Signed by: bascht
GPG Key ID: 5BCB1D3B4D38A35A
2 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -416,6 +416,7 @@ in
unlock '${config.home.homeDirectory}/bin/thinkpad-dock' \
timeout 300 '${config.home.homeDirectory}/bin/blur-lock' \
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"'
'';
Restart = "on-failure";