Bug 422591

Summary: Add "logout" option after inactivity period
Product: [Applications] systemsettings Reporter: Christophe Riolo Uusivaara <rosslaew>
Component: kcm_powerdevilAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: kde, kde, nate
Priority: NOR    
Version First Reported In: 5.18.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Christophe Riolo Uusivaara 2020-06-07 18:52:09 UTC
SUMMARY
We are multiple user on the same machine, and some leave idle sessions. I would like to set the power management so that idle users get logged off, but the only options are sleep/hibernate, lock screen and shutdown. 

STEPS TO REPRODUCE
1. Open Powerdevil configuration
2. Got to "Suspend session entry"
3. Check the options offered.

OBSERVED RESULT
No possibility to logout user/terminate session.

EXPECTED RESULT
This possibility is offered.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux
(available in About System)
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
My ultimate goal is to turn off the computer if there were only "idlers" logged in. Being able to poll the activity status of those users would be good already as I could write a cronjob that would do the rest.
Comment 1 Nate Graham 2020-06-11 04:47:56 UTC
Seems entirely reasonable.
Comment 2 David Edmundson 2020-07-22 13:56:31 UTC
Are these idle sessions screen locked?

In theory it should be queryable with logind, they will have the lockedHint set to true. I think that requires a bit of work our side, but I am more than happy to support that.

From logind you can also violently kill the session which would work for your scripts.

We cannot do a graceful logout after a period of inactivity. 
Applications can cancel or pause the process with the "you have unsaved changes blah blah". 

Putting this in our UI at a KDE level would then be problematic.
Comment 3 Nate Graham 2020-07-23 00:19:04 UTC
FWIW macOS offers this feature, and what they do is show a dialog with a 60 second timeout, at which point the app is killed. I guess they assume that if you enable this feature, your goal of logigng out of the system after inactivity trumps potential data integrity.
Comment 4 David Edmundson 2020-08-20 07:50:08 UTC
Git commit 72b1e92e115168512bb01f3df56b2ab1a7887c01 by David Edmundson.
Committed on 20/08/2020 at 07:39.
Pushed by davidedmundson into branch 'master'.

Update logind's SetLockedHint

SetLockedHint exists so that an external system can determine if a
session is locked or not without having to access the user's session
bus.

We support logind's requesting us to lock/unlock so it makes sense to
support this also.

M  +2    -0    ksldapp.cpp
M  +20   -4    logind.cpp
M  +9    -0    logind.h

https://invent.kde.org/plasma/kscreenlocker/commit/72b1e92e115168512bb01f3df56b2ab1a7887c01
Comment 5 David Edmundson 2020-08-20 08:06:15 UTC
>Are these idle sessions screen locked?

Assuming this was true:

The commit above adds support for easily querying locked state for another user making it easier to externally script.

This should allow

> Being able to poll the activity status of those users would be good already as I could write a cronjob that would do the rest.

---

Marking as needsinfo so you can reply if anything is missing.
Comment 6 Bug Janitor Service 2020-09-04 04:33:07 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Christophe Riolo Uusivaara 2020-09-04 05:05:14 UTC
Hello,
Indeed the idle sessions are locked so if it can be queried with logind it works for me!
Thank you for the work,
Cheers,
Christophe Riolo Uusivaara
Comment 8 David Edmundson 2020-09-04 07:47:05 UTC
cool cool