1

I'm using OpenSuse Leap 42.1 and I would like to remap my Keyboard. Now, I want to remap one key (The Sleep key) to lock the screen instead of sending the entire PC to sleep. For that reason, I need the Konsole-Command to lock the screen. I Googled and only found commands that works for Ubuntu/Debian/Fedora/KDE4, but I was unable to find anything that worked for my OpenSuse Version. Would you please provide any suggestions?

  • Why do you need Konsole to lock the screen? Usually your Desktop Environment provides a shortcut or a way to define one. – schaiba Nov 14 '16 at 10:44
  • Like I wrote in the question, I want to remap the Sleep-Key on my keyboard to use it as a Screen-Lock. And yes there are shortcuts, Master+L and the Desktop Icon but I want to do it with one key on my Keyboard, the Sleep Key. And for that I need the Command to do it over the Konsole. Or if you can provide me with a even better way, then that one. Greetings Nico – Nicolas Fischer Nov 15 '16 at 12:13
  • What DE/WM are you using? – schaiba Nov 15 '16 at 12:20
0

This works on Unity or GNOME.

On Unity or GNOME, you can lock the screen using the command dbus-send as follows:

dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock

Explanation:

The --type=method_call tells dbus-send to call a method.
The --dest=org.gnome.ScreenSaver tells it the command is in org.gnome.ScreenSaver.
The org.gnome.ScreenSaver.Lock tells it to lock the screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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