sway-profiles/bin/sp-lock
2024-06-15 12:25:22 -06:00

24 lines
728 B
Bash
Executable file

#!/bin/bash
source "/usr/lib/sp-functions"
lock_script="${conf_dir}/lockscript"
unlock_script="${conf_dir}/unlockscript"
outputs=( $(swaymsg -t get_outputs | jq -r '.[] | {name} | "\(.name)"') )
for o in ${outputs[@]};do
workspace=$(swaymsg -t get_workspaces | jq -r '.[] | select(.output) | {name} | "\(.name)"')
wpno=$(cat "${cache_dir}/displays/${o}")
wp_imgpath="${conf_dir}/wallpaper/${o}/${wpno}.jpg"
sl_imgpath="${cache_dir}/lock/${o}.jpg"
convert -scale 10% -blur 0x3 -resize 500% "${wp_imgpath}" "${sl_imgpath}"
sl_args="${sl_args}--image ${o}:${sl_imgpath} "
done
if [ -f "${lock_script}" ]; then
bash -c "${lock_script}"
fi
gtklock
if [ -f "${unlock_script}" ]; then
bash -c "${unlock_script}"
fi