mikluz wrote:Hi,
maybe you or someone else would know the answer on the question: "How to trigger locking or blank screen with a keyboard shortcut"?
You know, the same as works on M$ when you hit Windows+L, or Ctrl+Alt+L on Ubuntu-like distros?
I tried to search the answer on that question, but apparently I couldn't find anything that fully covers my issues.
Thanks a lot for your help.
Youtube Video:
https://youtu.be/aTrp83lgq_s
note- "xset q" is useful for checking screen and dpms settings, and changing them for testing (e.g., Monitor "off" is set for 1200 sec, or 20 min, and you want to test it, so you set dpms to 10 sec (xset dpms 0 0 10)). Changes here are temporary, and will not survive a reboot.
Run:
Open:
Add:
Code: Select all
# uncomment to put the monitor into power saving mode (DPMS)
hdmi_blanking=1
Open:
Code: Select all
sudo nano ~/.config/lxsession/LXDE-pi/autostart
Add:
Code: Select all
@xset s 0 0
@xset s noblank
@xset s noexpose
@xset dpms 0 0 1200
Save with 'Ctrl + x', then 'y', then 'enter'
open:
(note- if you do an "apt-get dist-upgrade" instead of an "apt-get upgrade", you will need to re-add this keybind)
Code: Select all
nano ~/.config/openbox/lxde-pi-rc.xml
find:
add:
Code: Select all
<keybind key="C-A-L">
<action name="Execute"><command>lxlock</command></action>
</keybind>
The above dpms '1200', means turn off monitor after 20min, and lock screen with light-locker (lxlock). Change to whatever time you want (in seconds).
If you do not want screen to autolock
If you prefer screen to just turn off/go into power save mode, and resume if you move mouse, or hit a key WITHOUT requiring login, and wish to manually do screenlock, then;
open
Code: Select all
sudo nano /etc/xdg/autostart/light-locker.desktop
find "
Exec=light-locker", change to
Code: Select all
Exec=light-locker --lock-after-screensaver=0 --no-lock-on-suspend --no-late-locking
Shortcuts:
1. add "ScreenLock" Menu shortcut (via Menu/Preferences/Main Menu Editor/Other/)
2. use keyboard 'Ctrl ' + 'Alt' + 'L' to turn off monitor and lock screen