diff --git a/way-displays-enable b/enable-displays-for-sleep similarity index 56% rename from way-displays-enable rename to enable-displays-for-sleep index b400a62..51a5007 100755 --- a/way-displays-enable +++ b/enable-displays-for-sleep @@ -1,18 +1,25 @@ #!/usr/bin/env zsh let just_list=0 -local operation="-d" +local operation="--on" local jq_filter_neg="| not" local ignored=() while getopts 'ldi:' name; do case "${name}" in + h) + echo 'enable-displays-for-sleep [-l] [-d] [-i]' + echo '-d disable instead of enable' + echo '-l print the list of display that would be changed' + echo '-i ignore display' + echo 'By default, enable displays.' + ;; l) just_list=1 ;; d) jq_filter_neg="" - operation="-s" + operation="--off" ;; i) ignored+="${OPTARG}" @@ -31,7 +38,9 @@ displays=(${displays:|ignored}) if ((just_list)); then printf '%s\0' ${displays} else + flags=() for display in ${displays}; do - way-displays "${operation}" DISABLED "${display}" + flags+=(--output "${display}" "${operation}") done + (( ${#flags} )) && wlr-randr ${flags} fi diff --git a/swayidle-lock-screen b/swayidle-lock-screen index 8da0297..2112512 100755 --- a/swayidle-lock-screen +++ b/swayidle-lock-screen @@ -22,7 +22,7 @@ function run { swaylock ${empty_flag} --color '#000000' else # get the list of currently disabled monitors so we don't touch them - local ignored=("${(0)$(way-displays-enable -l)}") + local ignored=("${(0)$(enable-displays-for-sleep -l)}") local ignored_args=() for name in ${ignored}; do # quote so it can be safely passed to swayidle @@ -30,8 +30,8 @@ function run { done swayidle -w -C /dev/null \ - timeout 15 "way-displays-enable -d ${ignored}" \ - resume "way-displays-enable {$ignored}" & + timeout 15 "enable-displays-for-sleep -d ${ignored}" \ + resume "enable-displays-for-sleep {$ignored}" & local swayidle_pid="${!}" swaylock ${empty_flag} ${img_flags} kill "${swayidle_pid}"