rj1
log | files | refs
commit 907b125531d601ee01842d03a88241289158219b
parent ffb8f4e930b1df88baf0e4d0ee03dac9e7523a84
author: rj1 <[email protected]>
date:   Wed,  5 Jun 2024 22:53:17 -0600

screen-lock: update to support multiple displays

Diffstat:
Mbin/screen-lock | 36++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/bin/screen-lock b/bin/screen-lock @@ -1,12 +1,28 @@ #!/bin/bash -sshot="/tmp/swaylockscreen.png" -blurred="/tmp/swaylockscreen-blurred.png" +# get displays +outputs=($(swaymsg -t get_outputs | jq -r '.[] | .name')) -grim $sshot && \ -ffmpeg -i $sshot -filter_complex boxblur=lr=8:lp=2 -y $blurred && \ -swaylock -i $blurred \ - --font "Hack Nerd Font Mono" \ +# create an array to store the output files +output_files=() + +# take a screenshot of each output, blur it, and store the file name +for output in "${outputs[@]}"; do + echo "Output: $output" + grim -o $output "/tmp/$output-sshot.png" + ffmpeg -i "/tmp/$output-sshot.png" -filter_complex boxblur=lr=8:lp=2 -y "/tmp/$output-blurred.png" + output_files+=("/tmp/$output-blurred.png") +done + +# construct swaylock command +swaylock_command="swaylock" +for ((i=0; i<${#outputs[@]}; i++)); do + swaylock_command+=" -i ${outputs[$i]}:${output_files[$i]}" +done + +# add other options to the swaylock command +swaylock_command+=" \ + --font \"Hack Nerd Font Mono\" \ --font-size=25 \ --text-color ffffffff \ --ring-color c678dd \ @@ -17,6 +33,10 @@ swaylock -i $blurred \ --line-color 00000000 \ --inside-color 282c34 \ --separator-color 00000000 \ - --indicator-radius=100 + --indicator-radius=100" + +# lock the screen +eval $swaylock_command -rm -f $sshot $blurred +# rm files +rm -f "${output_files[@]}"