Linux

Categorized | KDE, Security, cli

Lock your KDE screen from the command line

Did you know you can lock your current KDE screen by using the command line? For the 3.x series use

dcop kdesktop KScreensaverIface lock

and for KDE 4.x try

qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock

With the help of these you should be able to craft a simple shell script that will lock your screen at given actions. For example, you can leave your screen unlocked and make the PC activate the commands above when it detects mouse movement or when a certain application is launched.

Author Profile

T4L ;

Other posts by T4L

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


4 Comments

  1. BeteNoire

    The command for KDE 4 does not work.

    qdbus org.kde.krunner /ScreenSaver Lock
    Service ‘org.kde.krunner’ does not exist.

    1

  2. it is work for me on kde 4 thanks

    2

  3. BeteNoire, try:

    qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock
    xset dpms force off

    I’ve put this in a script in $HOME/bin, created a shortcut in the menu, and set “Win+L” as a shortcut. Thanks, T4L!

    3
  4. Roy Smith

    If you wish to launch the kde4 screen saver without the password prompt to exit, use this command:

    qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SetActive True

    4

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>