Remove lock screen blurring to prevent OLED burn-in

This commit is contained in:
dabruh 2024-06-03 15:49:33 +02:00
parent 895519a6cf
commit 480bf2f805
1 changed files with 4 additions and 32 deletions

View File

@ -7,46 +7,20 @@
# with openrc use loginctl # with openrc use loginctl
[[ $(cat /proc/1/comm) == "systemd" ]] && logind=systemctl || logind=loginctl [[ $(cat /proc/1/comm) == "systemd" ]] && logind=systemctl || logind=loginctl
LOCK_SCREEN_BLUR=${LOCK_SCREEN_BLUR:-false} LOCK_SCREEN_COLOR=${LOCK_SCREEN_COLOR:-000000}
LOCK_SCREEN_COLOR=${LOCK_SCREEN_COLOR:-29414f}
I3LOCK_RE="i3lock -(c|i) " I3LOCK_RE="i3lock -(c|i) "
_lock() { lock() {
i3lock -c "$LOCK_SCREEN_COLOR" i3lock -c "$LOCK_SCREEN_COLOR"
}
_unlock() { # Add a small delay to prevent possible race conditions with suspend
pkill -u "$USER" -f "$I3LOCK_RE" sleep 1
} }
is_locked() { is_locked() {
pgrep -u "$USER" -f "$I3LOCK_RE" >/dev/null pgrep -u "$USER" -f "$I3LOCK_RE" >/dev/null
} }
lock() {
local abort=false screen=/tmp/screenshot.png blurred=/tmp/screenshotblur.png
$LOCK_SCREEN_BLUR && sleep 0.25 && scrot -q 100 $screen # Take screenshot
_lock # Lock immediately
if [ -f $screen ]; then
# Blur screenshot
scrot -q 100 $screen || abort=true # Larger file size, but faster
convert -scale 10% -blur 0x1.25 -resize 1000% $screen $blurred || abort=true
rm $screen
$abort && return 1
# Now try to replace the solid color with the blurred image.
_unlock
i3lock -i $blurred || _lock
fi
# Add a small delay to prevent possible race conditions with suspend
sleep 1
}
case "$1" in case "$1" in
lock) lock)
is_locked || lock is_locked || lock
@ -58,11 +32,9 @@ case "$1" in
dm-tool switch-to-greeter dm-tool switch-to-greeter
;; ;;
suspend) suspend)
export LOCK_SCREEN_BLUR=false
lock && $logind suspend lock && $logind suspend
;; ;;
hibernate) hibernate)
export LOCK_SCREEN_BLUR=false
lock && $logind hibernate lock && $logind hibernate
;; ;;
reboot) reboot)