Configure your PAUSE key to lock the screen

From Linuxintro

I want to lock my screen by typing the PAUSE key. So, here is how I do it under Linux, it depends on your distribution and your desktop environment:

Ubuntu

Select Settings -> Keyboard -> Keyboard Shortcuts -> View and Customize Shortcuts -> System -> Lock Screen. Type the PAUSE key, then type "Set". This has been tested with Ubuntu 22.04.3.

KDE

To set your PAUSE key to lock the screen under KDE,

systemsettings
  • select "Shortcuts and Gestures" -> "Custom Shortcuts" -> "Edit" -> "New" -> "Global Shortcut" -> "Command/URL" -> enter "Pause"

Snapshot-pause-key.png

  • click on Trigger -> "None"
  • type the PAUSE key
  • click on "Action"
  • enter
qdbus org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.Lock

or (whatever works)

/usr/lib64/kde4/libexec/kscreenlocker_greet

or (whatever works)

/usr/lib64/kde4/libexec/kscreenlocker --forcelock
  • click "Apply"
  • test it by pressing the PAUSE key

See also