screenlock: Use swaylock everywhere
This commit is contained in:
@ -1,60 +1,37 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/fish
|
||||||
|
|
||||||
TMP_IMG="/tmp/lock.png"
|
|
||||||
|
|
||||||
{% if hostname == "sputnik" %}
|
|
||||||
|
|
||||||
# rendered for sputnik
|
|
||||||
LOCKPROG=i3lock
|
|
||||||
LOCKARGS="-nef --image=$TMP_IMG"
|
|
||||||
LOCKARGS_NOCOOL="-c 302f3b"
|
|
||||||
OPTIONAL_CMDS="scrot lockscreen-blur"
|
|
||||||
SCREENCAP="scrot -"
|
|
||||||
BLUR_FACTOR=20
|
|
||||||
|
|
||||||
{% elif hostname == "vostok" %}
|
|
||||||
|
|
||||||
# rendered for vostok
|
|
||||||
LOCKPROG=swaylock
|
|
||||||
LOCKARGS="--config $HOME/.config/sway/swaylock.config --image $TMP_IMG"
|
|
||||||
LOCKARGS_NOCOOL="--config $HOME/.config/sway/swaylock.config --color 302f3b"
|
|
||||||
OPTIONAL_CMDS="grim lockscreen-blur"
|
|
||||||
SCREENCAP="grim -t ppm -"
|
|
||||||
BLUR_FACTOR=40
|
|
||||||
|
|
||||||
{% elif hostname == "buran" %}
|
|
||||||
|
|
||||||
# rendered for buran
|
|
||||||
LOCKPROG=swaylock
|
|
||||||
LOCKARGS="--config $HOME/.config/sway/swaylock.config --image $TMP_IMG"
|
|
||||||
LOCKARGS_NOCOOL="--config $HOME/.config/sway/swaylock.config --color 302f3b"
|
|
||||||
OPTIONAL_CMDS="grim lockscreen-blur"
|
|
||||||
SCREENCAP="grim -t ppm -"
|
|
||||||
BLUR_FACTOR=40
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
echo "screenlock not configured for this system"
|
|
||||||
exit 1
|
|
||||||
{% end %}
|
|
||||||
|
|
||||||
|
# configured for wayland
|
||||||
|
set LOCKPROG swaylock
|
||||||
|
set OPTIONAL_CMDS grep sed grim lockscreen-blur
|
||||||
|
set CONFIG "$HOME/.config/sway/swaylock.config"
|
||||||
|
set FALLBACK_ARGS --config $CONFIG --color "302f3b"
|
||||||
|
set BLUR_FACTOR 40
|
||||||
|
|
||||||
# check if lock program is running
|
# check if lock program is running
|
||||||
if ps -e | grep " $LOCKPROG$"; then
|
if ps -e | grep " $LOCKPROG\$"
|
||||||
echo "$LOCKPROG is already running!"
|
echo "$LOCKPROG is already running"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
end
|
||||||
|
|
||||||
for CMD in $OPTIONAL_CMDS; do
|
|
||||||
if ! command -v "$CMD" &> /dev/null
|
|
||||||
then
|
|
||||||
echo "$CMD could not be found, falling back to basic mode."
|
|
||||||
|
|
||||||
$LOCKPROG $LOCKARGS_NOCOOL "$@"
|
|
||||||
|
|
||||||
|
for cmd in $OPTIONAL_CMDS
|
||||||
|
if not command -v $cmd &>/dev/null
|
||||||
|
echo "$cmd could not be found, falling back to basic mode."
|
||||||
|
$LOCKPROG $FALLBACK_ARGS
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
end
|
||||||
done
|
end
|
||||||
|
|
||||||
$SCREENCAP | lockscreen-blur -o $TMP_IMG -b $BLUR_FACTOR --stamp ~/.config/wallpapers/ferris-stamp.png
|
set outputs (swaymsg -t get_outputs -r | grep "name" | sed 's/^.*"name": "//' | sed 's/",$//')
|
||||||
|
|
||||||
|
# take one screenshot of each output
|
||||||
|
for output in $outputs
|
||||||
|
set img "/tmp/lock-$output.png"
|
||||||
|
grim -o $output -t ppm - | lockscreen-blur -o $img -b $BLUR_FACTOR --stamp ~/.config/wallpapers/ferris-stamp.png &
|
||||||
|
set -a images "--image"
|
||||||
|
set -a images "$output:$img"
|
||||||
|
end
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
|
$LOCKPROG --config $HOME/.config/sway/swaylock.config $images
|
||||||
|
|
||||||
$LOCKPROG $LOCKARGS "$@"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user