diff --git a/swayidle-lock-screen b/swayidle-lock-screen index 88daa63..23af118 100755 --- a/swayidle-lock-screen +++ b/swayidle-lock-screen @@ -9,7 +9,7 @@ function run { flock -n 4 || exit 0 dunstctl set-paused true swayidle -w -C /dev/null \ - timeout 15 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' & + timeout 15 "${suspend_command}" resume "${wake_command}" & local swayidle_pid="${!}" swaylock -e ${img_flags} kill "${swayidle_pid}" @@ -26,6 +26,8 @@ function fix_eww { } local background=false +local suspend_command='hyprctl dispatch dpms off' +local wake_command='hyprctl dispatch dpms on' local fix_eww=() while [[ "${1}" =~ '^-' ]]; do case "${1}" in @@ -40,6 +42,9 @@ while [[ "${1}" =~ '^-' ]]; do fix_eww+="${2}" shift ;; + -s) + local suspend_command='sudo /usr/lib/systemd/systemd-sleep suspend &' + ;; -*) printf "error: unknown flag '%s'\n" "${1}" >&2 ;;