Implemented blurred lock screen.

This commit is contained in:
dabruh 2022-06-10 17:30:12 +02:00
parent 038e7e7e8c
commit ed0b3da264
2 changed files with 28 additions and 7 deletions

View File

@ -1,6 +1,6 @@
pacman-any:i3-gaps,feh,i3status,network-manager-applet,pasystray,xautolock,inotify-tools,xss-lock,noto-fonts-emoji
pacman-any:gst-libav,phonon-qt5-gstreamer,gst-plugins-good,qt5-quickcontrols,qt5-graphicaleffects,qt5-multimedia
pacman-any:code,vim,ufw
pacman-any:code,vim,ufw,scrot
pacman-laptop:brightnessctl
aur-any:picom-git,flashfocus-git,sddm-theme-aerial-git
@ -9,7 +9,7 @@ apt-any:libxext-dev,libxcb1-dev,libxcb-damage0-dev,libxcb-xfixes0-dev,libxcb-sha
apt-any:python3,python3-pip
apt-any:libxcb-render0-dev,libffi-dev,python-dev,python-cffi
apt-any:sddm,gstreamer1.0-libav,phonon4qt5-backend-gstreamer,gstreamer1.0-plugins-good,qml-module-qtquick-controls,qml-module-qtgraphicaleffects,qml-module-qtmultimedia,qt5-default
apt-any:codium,vim,ufw
apt-any:codium,vim,ufw,scrot
apt-laptop:brightnessctl
pip-any:flashfocus

View File

@ -7,20 +7,40 @@
# with openrc use loginctl
[[ $(cat /proc/1/comm) == "systemd" ]] && logind=systemctl || logind=loginctl
LOCK_SCREEN_BLUR=${LOCK_SCREEN_BLUR:-false}
LOCK_SCREEN_COLOR=${LOCK_SCREEN_COLOR:-29414f}
_lock() {
i3lock -c "$LOCK_SCREEN_COLOR"
}
_unlock() {
pkill -u "$USER" -f "i3lock -(c|i) "
}
lock() {
if command -v blurlock >/dev/null; then
blurlock
return 0
local screen=/tmp/screenshot.png blurred=/tmp/screenshotblur.png
_lock # Lock immediately
if $LOCK_SCREEN_BLUR; then
# Take screenshot and blur it
scrot -q 100 $screen || return 1 # Larger file size, but faster
convert -scale 10% -blur 0x1.25 -resize 1000% $screen $blurred || return 1
rm $screen
# Now try to replace the solid color with the blurred image.
_unlock
i3lock -i $blurred || _lock
fi
i3lock --color="$LOCK_SCREEN_COLOR"
# Add a small delay to prevent possible race conditions with suspend
sleep 1
}
case "$1" in
lock)
lock
lock; echo $?
;;
logout)
i3-msg exit
@ -51,6 +71,7 @@ case "$1" in
echo "== ! i3exit: missing or invalid argument ! =="
$0 help
exit 2
;;
esac
exit 0