Screenlock blocked by certain apps

Hi everyone,

It seems that screen lock is being prevented by certain apps like Discord or any other app with active usage. I created a small shell script that tracks my mouse movement and forces a screen lock after a specified idle time. Is there any way to get around this issue? I’ve found numerous bug reports about this problem but no solutions.

I’m trying to avoid OLED burn-in.

Plasma 6.0.5 / Kernel 6.6.41

*** EDIT: Since I couldn’t find a feasible solution for unconditional screen locking with these apps, I’m using a small function that tracks my mouse movement and locks my screen after 6 minutes and 3 confirmed idle states. Maybe this will help someone.

this guy got a similar issue:

#!/bin/bash

killall -9 evtest
/usr/bin/evtest /dev/input/event12 >> /tmp/mousetrack &

while true
do

idlecount=1
idlefail=3

idlecheck () {


idletime=$(/usr/bin/ls -l --time=mtime /tmp/mousetrack | cut -c 27-30)
#3x mouse idle confirmation in 6 minutes to lock the screen
sleep 120
idletime2=$(/usr/sbin/ls -l --time=mtime /tmp/mousetrack | cut -c 27-30)


if [ $idletime == $idletime2 ]; then
idlecount=$(($idlecount+1))

if (( $idlecount > $idlefail )); then
idlecount=0
sleep 1
else
idlecheck
fi
else 
idlecheck
fi
}

idlecheck

echo $(date +%F_%T) >> /tmp/screenlock_executed && loginctl lock-session 2>&1 1>/dev/null

done