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