Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

First of all, I'm aware a similar question for GNOME is asked here: "Switch off laptop backlight when locking screen".


I would like to turn off my screen on locking the session for power saving reasons.

Actual problem

Locking the screen on Kubuntu (KDE) inevitably triggers the screensaver as far as I can see. There's no screensaver option other than 'Blank screen' together with its background colour set to black that comes just close to my goal. It blanks the screen, but doesn't turn off the screen. Screen's backlight will still be on and not saving any power.

Current workaround

A workaround via a script + shortcut key is possible, however, it's just a workaround since it doesn't trigger on all ways to lock the session. Therefore, I think it should be possible to have it done more elegantly, for example by providing this option in KDE's configuration dialog of the screensaver.

The workaround I am now using is the following. A script that locks the screen and turns off the screen:


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

and let it run with a shortcut key via a custom menu entry. It works.

Here's why I consider it to be a workaround rather than a solution. It doesn't work for other ways to trigger the locking of the session.

My actual question(s)

Do I need to touching/patching KDE's source?

  • If not what are my options?
  • If so,
    • could someone point me to where I can get started?
    • what do you think is the recommended place in the GUI for configuration?

I'm using Kubuntu 12.04 and willing to upgrade to KDE 4.9 or waiting for the 12.10 release.

share|improve this question

3 Answers 3

up vote 9 down vote accepted

Found a way:

  1. Go to System SettingsApplication and System NotificationsManage Notifications.

  2. Select Screen Saver as the Event Source

  3. Locate and select the Screen Locked

  4. add this command to the event:

    xset dpms force off

enter image description here

It will turn off all displays every time it gets locked.

share|improve this answer
This is simply SWEET and clever. The trick is to think of "Screen Saver" in the context of locking the screen. –  gertvdijk Sep 30 '13 at 12:25
For Kubuntu 15.04 users - this approach appears hit a bug in which KDE daemon crashes completely, taking the whole session with it... :-( –  gertvdijk Jul 26 at 17:00
@gertvdijk Hmm. Might have to check that - I'm still on 14.04, and it's working for me. Though I've slowly expanded this to about half a dozen different things that happens when I lock/unlock. –  Someone Somewhere Jul 28 at 6:22
xset dpms force standby seems to be very reliable and doesn't need the sleep 1 ; xset dpms force off trick. –  Alan Thompson Sep 17 at 4:00
@AlanThompson, the sleep 1 is just so that if you're using a mouse to click a button, you have time to let go of the mouse and it to stop moving before the display turns off. Otherwise, it can wake up the display instantly, which might mean you need to enter your password before you can lock the display again. Not sure where I recommended using sleep 1, though. –  Someone Somewhere Sep 18 at 5:54

One possible solution is switch to xscreensaver. The man page actually come with instruction.

Following is outline

  1. Disable KDE screen saver

    1. K menu -> Computer -> System Settings -> Display and Monitor -> Screen Saver
    2. Uncheck Start automatically after
  2. Install xscreensaver

    sudo apt-get install xscreensaver

  3. Create ~/.kde/Autostart/xscreensaver.desktop

    Add following lines into it

    [Desktop Entry]
  4. Replace KDE lock screen

    cd /usr/lib/kde4/libexec
    sudo mv kscreenlocker kscreenlocker.original
    sudo vim kscreenlocker

    Add following lines into kscreenlocker

    xscreensaver-command -lock
  5. Use xscreensaver-demo to configure dpms (no sudo)

    Configure DPMS in Advance tab. The minimum standby is 1min.

    However, you can try make it less by editing ~/.xscreensaver after first time configuration. Look for dpmsStandby: in the file.

    Not sure if it work if dpmsStandby: is changed to 0:00:00. I am testing with a VM and the black screen look the same.

share|improve this answer
Are you sure replacing kscreenlocker is a good idea? It does more than locking the screen, reading from kscreenlocker --help. Other than that, it's a good suggestion to move to Xscreensaver! –  gertvdijk Dec 29 '12 at 21:52
My bad, I should have added that moving to Xscreensave will actually replace your kde screen saver also. Other than that there is no side effect. The kscreenlocker --help is showing how it can be used/call, it works with kde screen saver. Moving to xscreensaver is a work around for now. –  John Siu Dec 29 '12 at 22:01
Regarding new vesion of KDE you can check out this post and this post. People with KDC 4.9 or 4.10 seems to encounter some very annoying issue with dpms and actually want to turn off the feature. So I would say don't upgrade kde for now. –  John Siu Dec 29 '12 at 22:06

System Settings / Personal / Light Locker (in the new Whisker menu)

share|improve this answer
Can you explain how this works and what it does? –  Whaaaaaat Aug 31 '14 at 3:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.