After I started using KDE Plasma, I noticed it’s missing an option to change screen timeout on lock screen only. So I created these two scripts to overcome this problem. One sets your desired value after which screen should go to sleep, second restores the default value on unlocking Plasma. The scripts need to be added to System Settings - Notifications - Screen Saver - Run command. Scripts:
Script to add on locking (screenlock.sh):
#!/bin/bash
# Set DPMSControl idleTime to 60 seconds using kwriteconfig5 (set idleTime to time you wish in seconds)
kwriteconfig5 --file ~/.config/powermanagementprofilesrc --group AC --group DPMSControl --key idleTime '60'
# Use qdbus to actually apply config
qdbus org.freedesktop.PowerManagement /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.reparseConfiguration
qdbus org.freedesktop.PowerManagement /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.refreshStatus
echo "Idle time set to 60 seconds."
Script to add on unlocking (screenunlock.sh):
#!/bin/bash
# Restore DPMSControl idleTime to 600 seconds using kwriteconfig5
kwriteconfig5 --file ~/.config/powermanagementprofilesrc --group AC --group DPMSControl --key idleTime '600'
# Use qdbus to actually apply config
qdbus org.freedesktop.PowerManagement /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.reparseConfiguration
qdbus org.freedesktop.PowerManagement /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.refreshStatus
echo "Idle time restored to 600 seconds."
Remember to set scripts as executable (e.g. chmod+x) and you should be good to go. Also, powerdevil is required for these scripts to work. Hope this serves you well !