Update waybar sleep stuff
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user