This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Detect when screen is locked ?

Tags: None
(comma "," separated)
felixmeyer
Registered Member
Posts
1
Karma
0

Detect when screen is locked ?

Mon Oct 24, 2016 11:37 pm
Hello,

Sorry for the bad english, i'm french ;)
I've been looking for a answer since 2 days, sont hope i will find it here.
Also, i don't know if i am in the right category, so if i'm wrong, please redirect me :P

I'm running Debian, in KDE.

This is my problem :
I've created a variant of the "Kidtimer" program, to limite the time passed by my children on their computer. It currently counts the time when the session is active, so they have for example 2 Hours of computer on week-ends. But my children now wants to listen to music without loosing time (and also making renders in Blender without loosing time).
I thinked i can and a command that detect when the screen is locked or not, so the computer will count time ont when screen is activated, wich means they can do background tasks. So, I am looking for the command that can mesure when screen is locked (currently, my program detect when session is open or not) to complete the program.

Does someone have a idea how i can do that ?
Help is appreciated :)

Thanks =D
User avatar
Rog131
Registered Member
Posts
828
Karma
10

Re: Detect when screen is locked ?

Tue Oct 25, 2016 3:46 pm
felixmeyer wrote:Hello,
.
.
.
I'm running Debian, in KDE.


...So, I am looking for the command that can mesure when screen is locked (currently, my program detect when session is open or not) to complete the program.

Does someone have a idea how i can do that ?
Help is appreciated :)

Thanks =D


You could examine the active processes.

At here, with the plasma 5, when the screen is locked:
Code: Select all
$ ps -ef | grep kscreenlocker
rog131       2537   743 36 18:33 ?        00:00:07 /usr/lib/kscreenlocker_greet --immediateLock --graceTime 5000 --ksldfd 31
airdrik
Registered Member
Posts
1854
Karma
5
OS

Re: Detect when screen is locked ?

Mon Oct 31, 2016 7:01 pm
in dbus, there is the org.freedesktop.ScreenSaver.ActiveChanged signal that your app can listen to, to be notified when the screen is locked or unlocked.


airdrik, proud to be a member of KDE forums since 2008-Dec.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]