Bug 456238

Summary: Active job progress notifications inappropriately block screen locking
Product: [Plasma] plasmashell Reporter: Artur Rudenko <catcool419>
Component: NotificationsAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, me, nate
Priority: NOR    
Version First Reported In: 5.25.2   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.27
Sentry Crash Report:
Attachments: chrome blocking sleep and screen locking (but not screen dimming)
pygtk4 minimal inhibit example (chromium most likely uses gtk to do this)

Description Artur Rudenko 2022-07-02 12:59:29 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

When there's an active notification i.e. it indicates some process progress (like downloading in chrome), automatic lockscreen doesn't trigger, only screensaver does

STEPS TO REPRODUCE
1. Set both dim screen and automatic lock timeout to 1 minute
2. Start a large file downloading in chromium with plasma integration addon

OBSERVED RESULT
After 1 minute, screen dimming triggers, but auto locking doesn't

EXPECTED RESULT
Both auto lock and screen dimming work after 1 minute

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
I think this issue also can be randomly caused by regular notifications if those appear and persist while auto locking timeout ends
Comment 1 Kai Uwe Broulik 2022-09-10 20:51:53 UTC
Check whether Chrome actually posts an inhibition. I think Chrome blocks suspend during downloads, but that shouldn't block the screen locker.
Comment 2 Artur Rudenko 2022-09-11 09:23:40 UTC
Created attachment 151978 [details]
chrome blocking sleep and screen locking (but not screen dimming)
Comment 3 Artur Rudenko 2022-09-11 09:25:58 UTC
(In reply to Kai Uwe Broulik from comment #1)
> Check whether Chrome actually posts an inhibition. I think Chrome blocks
> suspend during downloads, but that shouldn't block the screen locker.

I added an attachment. Yes, it blocks sleep, but why would it also block screen locking? I also installed plasma integration extension in chromium if it matters.
Comment 4 Artur Rudenko 2022-09-11 10:13:36 UTC
Created attachment 151980 [details]
pygtk4 minimal inhibit example (chromium most likely uses gtk to do this)
Comment 5 Artur Rudenko 2022-09-11 10:23:21 UTC
I also created minimal pygtk inhibit example and when I run it it says  "Is currently blocking sleep and screen locking" however the flag that I set there is GTK_APPLICATION_INHIBIT_SUSPEND

So the suspend inhibitor is also perceived as screen locking inhibitor, but gtk documentation says that GTK_APPLICATION_INHIBIT_IDLE should block screen locking and not GTK_APPLICATION_INHIBIT_SUSPEND (https://docs.gtk.org/gtk4/flags.ApplicationInhibitFlags.html)

I didn't try inhibiting using qt or dbus though, but chromium most likely uses gtk to do this
Comment 6 Nate Graham 2023-04-28 04:24:47 UTC
So the issue here is not that the notification itself blocks screen locking, but rather than Chrome does it; that notification is simply a visible side effect of the file download. 

There was a bug recently where an app requesting to block suspend would also cause screen locking to be blocked; this has been fixed in Plasma 5.27.