Update waybar sleep stuff

This commit is contained in:
2026-02-18 19:32:13 -08:00
parent 44145ecfde
commit df69a5b1ea
3 changed files with 27 additions and 3 deletions

View File

@ -26,6 +26,7 @@ done
function is_valid_sleep_time() {
[[ "${1}" = forever ]] \
|| [[ "${1}" = infinity ]] \
|| [[ "${1}" =~ ' *([0-9]+[smhd]? *)+' ]]
}
@ -53,7 +54,9 @@ else
exit
elif is_valid_sleep_time "${choice}"; then
[[ "${choice}" == forever ]] && choice=infinity
systemctl --user start "manual-inhibit-sleep@${choice}.service"
local unit="$(systemd-escape --template=manual-inhibit-sleep@.service \
"${choice}")"
systemctl --user start "${unit}"
else
printf 'Invalid sleep time: %s\n' "${choice}" 1>&2
fi