How to turn off screen (DPMS) together with locking session in KDE?

Found a way for KDE 4 (up to Ubuntu 14.10). For modern KDE 5 see other answer.

  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.


Confirmed: running the command: /bin/sleep 1 ; /usr/bin/xset dpms force off within the screen locked notification works for Plasmashell 5.10.

Go to: System Settings > Notifications > Event source "Screen Saver":

Notifications -- System Settings


As of KDE 5, most of the solutions here no longer work.

Here's what I found that works though (as of 2016-09-28), create a text document and in it copy and paste the following code:

#!/bin/sh
sleep 0.5
loginctl lock-session
xset dpms force off

and then save it as "KDE5lockscreenanddpms.sh" The name doesn't matter, just make sure you have the .sh at the end of it. Then navigate to where you saved with your file manager, right click on it and open up properties>permissions> and make it executable.

Now you can click on it and it will run the script which will lock your screen and then after .5 seconds will turn your monitor(s) off.

Here are some posts with the info about these commands.

KDE.org- loginctl lock-session

Linux-apps.com - sleep 0.5 xset dpms force off