Reply to topic

Lock screen programatically

colinw
Registered Member
Posts
13
Karma
0

Lock screen programatically

Wed Sep 30, 2015 8:10 pm
Anyone know how to lock the screen from the command line in KDE? I can't find any information online that isn't out of date.
User avatar Rog131
Registered Member
Posts
828
Karma
10

Re: Lock screen programatically

Thu Oct 01, 2015 8:04 am
At here the:
Code: Select all
qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock

seems to work.

At here:
Desktop: KDE Plasma 5.4.1
Distro: Arch Linux
User avatar eliasp
Registered Member
Posts
19
Karma
0
OS
You might want to use a more generic solution by simply asking logind to lock a session.

Either via `loginctl` or through D-Bus on `org.freedesktop.login1`.
colinw
Registered Member
Posts
13
Karma
0

Re: Lock screen programatically

Thu Oct 01, 2015 2:53 pm
That works great thanks for the responses!

Extension if you want to lock the screen and sleep the computer programmatically or from a shortcut:
Code: Select all
qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock && echo -n mem | sudo tee /sys/power/state
mgraesslin
KDE Developer
Posts
572
Karma
7
OS

Re: Lock screen programatically

Thu Oct 01, 2015 3:00 pm
just do loginctl suspend - that will suspend the system and automatically lock the screen.
hussamaltayeb
Registered Member
Posts
9
Karma
0
OS

Re: Lock screen programatically  Topic is solved

Thu Oct 01, 2015 3:07 pm
loginctl lock-session ( there is no loginctl suspend)
to suspend:
systemctl suspend.
mgraesslin
KDE Developer
Posts
572
Karma
7
OS

Re: Lock screen programatically

Thu Oct 01, 2015 3:13 pm
sorry, of course systemctl suspend. And yes that locks automatically (I implemented it, because suspend through GUI was broken for me ;-)

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], dontdieych, duanedotmutt, Google [Bot], Majestic-12 [Bot], Nuc!eoN, psalehi, Sogou [Bot], uriel