bin/sway_lock: take screenshot for each output, use for lockscreen
also reduce processing time
This commit is contained in:
parent
a099e583c7
commit
c3d0af22cd
1 changed files with 27 additions and 8 deletions
|
@ -1,23 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source $HOME/.config/sway/bin/sway_helpers
|
source $HOME/.config/sway/bin/sway_helpers
|
||||||
IMAGE=$HOME/.lockscreen.png
|
|
||||||
LOCK_IMAGE=$HOME/.config/sway/bin/lock.png
|
LOCK_IMAGE=$HOME/.config/sway/bin/lock.png
|
||||||
OUTPUT=$(swaymsg -t get_outputs -p | grep focused | cut -d " " -f 2)
|
|
||||||
MEDIA_APP=playerctl
|
MEDIA_APP=playerctl
|
||||||
SCROT_APP=grim
|
SCROT_APP=grim
|
||||||
SCROT_ARGS=" -o $OUTPUT -t png"
|
SCROT_APP_ARGS=" -t jpeg"
|
||||||
|
SCROT_FILE_BASE=$HOME/.lockscreen
|
||||||
|
SCROT_FILE_EXT=jpg
|
||||||
LOCK_APP=swaylock
|
LOCK_APP=swaylock
|
||||||
LOCK_ARGS=" -f -F -e -s fill -c 000000 --indicator-radius 100 --indicator-thickness 20 -i $IMAGE"
|
LOCK_ARGS=" -f -F -e -s fill -c 000000 --indicator-radius 100 --indicator-thickness 20"
|
||||||
INHIBIT_FILE=$HOME/.inhibit_lock
|
INHIBIT_FILE=$HOME/.inhibit_lock
|
||||||
|
|
||||||
function _clean() {
|
function _clean() {
|
||||||
rm -vf $IMAGE
|
for output in $(_outputs); do
|
||||||
|
SCROT_FILE=${SCROT_FILE_BASE}_${output}.${SCROT_FILE_EXT}
|
||||||
|
rm -vf $SCROT_FILE
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function _lock() {
|
function _lock() {
|
||||||
_check_inhibit $INHIBIT_FILE
|
_check_inhibit $INHIBIT_FILE
|
||||||
$MEDIA_APP pause
|
$MEDIA_APP pause
|
||||||
_check_running $LOCK_APP
|
_check_running $LOCK_APP
|
||||||
|
for output in $(_outputs); do
|
||||||
|
SCROT_FILE=${SCROT_FILE_BASE}_${output}.${SCROT_FILE_EXT}
|
||||||
|
LOCK_ARGS+=" -i ${output}:$SCROT_FILE"
|
||||||
|
done
|
||||||
$LOCK_APP $LOCK_ARGS
|
$LOCK_APP $LOCK_ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +36,22 @@ function _on() {
|
||||||
swaymsg "output * dpms on"
|
swaymsg "output * dpms on"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _outputs() {
|
||||||
|
swaymsg -t get_outputs | jq '.[] |select(.active == true) | .name' | while read line; do
|
||||||
|
echo ${line//\"/}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function _screenshot() {
|
function _screenshot() {
|
||||||
$SCROT_APP $SCROT_ARGS $IMAGE
|
for output in $(_outputs); do
|
||||||
convert -blur 4x4 $IMAGE $IMAGE
|
SCROT_FILE=${SCROT_FILE_BASE}_${output}.${SCROT_FILE_EXT}
|
||||||
convert -composite -gravity center $IMAGE $LOCK_IMAGE $IMAGE
|
echo $SCROT_FILE
|
||||||
|
$SCROT_APP $SCROT_APP_ARGS -o $output $SCROT_FILE
|
||||||
|
# convert -blur 0x5 $SCROT_FILE $SCROT_FILE
|
||||||
|
# convert -motion-blur 15x15 $SCROT_FILE $SCROT_FILE
|
||||||
|
convert -scale 20% -blur 0x2.5 -resize 500% $SCROT_FILE $SCROT_FILE
|
||||||
|
convert -composite -gravity center $SCROT_FILE $LOCK_IMAGE $SCROT_FILE
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
## main
|
## main
|
||||||
|
|
Loading…
Reference in a new issue