Browse Source

Make lockscreen.sh screenres grab wm agnostic, add comments

master
Riyyi 5 years ago
parent
commit
3524441ba8
  1. 24
      .scripts/wm/lock.sh

24
.scripts/wm/lock.sh

@ -1,26 +1,30 @@
#!/bin/sh #!/bin/sh
ICON="$XDG_CACHE_HOME/lock.png" LOCK="$XDG_CACHE_HOME/lock.png"
if [ ! -f "$ICON" ]; then # Cache the lock image
touch "$ICON" if [ ! -f "$LOCK" ]; then
touch "$LOCK"
# Get the resolution of the first active monitor # Get the resolution of the primary monitor
RES="$(i3-msg -t get_outputs | \ RES="$(xrandr -q | grep ' connected primary' \
jq '.[] | select(.active==true) | .rect | .width, .height' | \ | grep -Eo '[0-9]{3,4}x[0-9]{3,4}' | head -c -1)"
head -n 2 | head -c -1 | tr '\n' 'x')"
convert "$(dirname "$0")/lock.png" -background none -gravity center -extent "$RES" "$ICON" # Generate lock image
convert "$(dirname "$0")/lock.png" -background none -gravity center -extent "$RES" "$LOCK"
fi fi
# Disable screensaver
revert() { revert() {
xset dpms 0 0 0 xset s off
xset -dpms
} }
# Set screensaver to 30 seconds
trap revert HUP INT TERM trap revert HUP INT TERM
xset +dpms dpms 30 30 30 xset +dpms dpms 30 30 30
i3lock -n -i "$ICON" -B 6 -S 1 -e \ i3lock -n -i "$LOCK" -B 6 -S 1 -e \
--radius=47 \ --radius=47 \
--ring-width=5.0 \ --ring-width=5.0 \
--verifcolor=00000000 \ --verifcolor=00000000 \

Loading…
Cancel
Save