dotfiles/.local/bin/scripts/save
2025-02-04 11:57:49 +01:00

7 lines
294 B
Bash
Executable file

#!/bin/sh -e
# Put system to sleep after specified number of seconds
# If used in a pipe, put a command into /tmp/save to override
mpc pause || mpdr
$(which timer || sleep) "${@:-30}"
# TODO delay in case I happen to still be on PC - use idle?
$(cat /tmp/save 2>/dev/null) || systemctl suspend