Wednesday, 26 May 2010

How to lock & unlock the KDE4 screensaver from command line

Here are two DBUS commands you can use to start or stop the KDE4 screensaver (previously known as kscreensaver or kscreenlock) from the command line.
Enter one of the following two commands into your linux shell (bash):

Lock:
dbus-send --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.Lock

Unlock without password:
dbus-send --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SetActive boolean:false

Both these commands work with the latest KDE 4.3.5

1 comment:

Peter Wall said...

Hi,

Have you had any luck getting this to work on newer versions of KDE?

I'm using 4.13.3 and have been unable to get this to unlock.