Cleanup stuff

This commit is contained in:
Alexander Rosenberg 2023-11-14 20:54:20 -08:00
parent a502b72299
commit 5d80c98c1f
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
12 changed files with 24 additions and 10 deletions

View File

@ -5,31 +5,45 @@ function run {
swayidle -w -C /dev/null \ swayidle -w -C /dev/null \
timeout 15 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' & timeout 15 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' &
local swayidle_pid="${!}" local swayidle_pid="${!}"
swaylock -e "${@}" swaylock -e ${img_flags}
kill "${swayidle_pid}" kill "${swayidle_pid}"
hyprctl dispatch dpms on hyprctl dispatch dpms on
dunstctl set-paused false dunstctl set-paused false
fix_eww
}
function fix_eww {
for bar in ${fix_eww}; do
eww open "${bar}"
done
} }
local background=false local background=false
let img_index=1 local fix_eww=()
for arg; do while [[ "${1}" =~ '^-' ]]; do
case "${arg}" in case "${1}" in
--)
shift
break
;;
-f) -f)
background=true background=true
((++img_index)) ;;
-b)
fix_eww+="${2}"
shift
;; ;;
-*) -*)
printf "error: unknown flag '%s'\n" "${arg}" >&2 printf "error: unknown flag '%s'\n" "${1}" >&2
((++img_index))
;; ;;
esac esac
shift
done done
(( ${#} >= ${img_index} )) && img_flags=(-s fill -i "${@[${img_index}]}") (( ${#} != 0 )) && img_flags=(-s fill -i "${1}")
if ${background}; then if ${background}; then
run ${img_flags} & run '${img_flags}' &
else else
run ${img_flags} run '${img_flags}'
fi fi