How to use scroll lock as a keyboard shortcut [18.04/GNOME]?

I'd like to use the scroll lock key as a keyboard shortcut for Volume Down in Ubuntu 18.04. This worked fine in 14.04 but it seems GNOME won't recognize the key anymore.

I do not want to use the scroll bar as a mod key. I tried setting it as Mod 3 as some answers suggest and that doesn't work either.

6

1 Answer

Answer: gsettings set org.gnome.settings-daemon.plugins.media-keys volume-down "['Scroll_Lock']"

Explaining to myself (for future reference):

Ubuntu comes with xev, that capture input from keyboard and mouse.
Open xev and press scroll lock, there you can see what is the command associated with the key

enter image description here

"Scroll_Lock" is the string that represents the key scroll lock.


Observation:
Some popular media keys can be found inside /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.plugins.media-keys.gschema.xml

For example, there you will find that XF86Calculator is the media key that open the calculator and XF86AudioPause is the media key to pause. You could make this keys do another command or action, for example:
gsettings set org.gnome.settings-daemon.plugins.media-keys volume-down "['XF86AudioPause']"

enter image description here


Custom keybindings:
Very annoying... I recommend you to create a custom keybinding empty and add the key using the terminal.
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding 'Scroll_Lock'

custom0 is the first custom keybinding
custom1 is the second custom keybiding
custom2 is the third custom keybinding...


References:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like