dotfiles/.local/bin/scripts/save

8 lines
294 B
Text
Raw Normal View History

2023-04-12 08:35:48 +02:00
#!/bin/sh -e
2023-09-12 01:16:35 +02:00
# Put system to sleep after specified number of seconds
2025-02-04 11:52:56 +01:00
# If used in a pipe, put a command into /tmp/save to override
2024-09-15 17:42:56 +03:00
mpc pause || mpdr
$(which timer || sleep) "${@:-30}"
2025-02-04 11:52:56 +01:00
# TODO delay in case I happen to still be on PC - use idle?
$(cat /tmp/save 2>/dev/null) || systemctl suspend