0

Some of my many Emacs 27.5's customized key bindings do not work when I work with Ubuntu 20.04 on a Lenovo ThinkPad T15g Gen 1 with a US keyboard.

Most key bindings work, but some like super-o or super-p, Meta-! don't. When I type them on Gnome's terminal outside of Emacs, the cursor blinks. Or if I am on the navigation bar and I type them, the bar blinks. But nothing ever happens.

To start with I disabled all of Ubuntu's default key bindings (in settings and with dconf-editor), but it seems that the window manager reacts to some of my Emacs's key bindings even though they don't activate anything.

This question is related but is different to this other question because here I am asking about how to identify the place where my OS/WM is intercepting specific keybindings so that I can go there and disable them.

4
  • 1
    Ubuntu allows the window manager and other processes to steal the keybindings before Emacs sees them. If you are using Emacs inside the terminal, it further depends on what the terminal is willing to pass on to Emacs. Far more keys are available when running Emacs GUI directly instead of inside the terminal. I find it hard to figure out what's stealing keys but you can sometimes find eating keystrokes by running gsettings list-recursively | grep Super or gsettings list-recursively | grep Mod4. I think gsettings and dconf-editor might show the same things though.
    – amitp
    Commented Dec 19, 2021 at 23:47
  • Does this answer your question? How can I override an OS key binding in Emacs?
    – NickD
    Commented Dec 20, 2021 at 2:55
  • The trouble with your edited question is that now the question is not about emacs: it is about the OS and window managers/desktop environments, so it is not relevant to Emacs SE. You should probably ask it on the Unix & Linux SE.
    – NickD
    Commented Dec 20, 2021 at 16:24
  • Very probably you are right but the same post here has attracted no replies. And it is a fact of life in Emacs that there are tons of keybindings. And unless you use EXWM, these keybindings are going to conflict with your WM, so it is useful for any Emacs user to know how to solve these conflicts... So I guess my point is that this issue is relevant for our life in Emacs
    – Daniel
    Commented Dec 23, 2021 at 17:10

3 Answers 3

2

There’s nothing Emacs can do about that. File a bug report on the software further up the stack, such as your window manager or desktop environment.

0

Thank you very much for your answer, @amitp. Thanks to it I've discovered the culprits for all the interceptions but one: Alt-! (I've searched for Alt but can't find any combination with !. However, Meta-! doesn't work in Emacs):

org.gnome.mutter.keybindings switch-monitor ['<Super>p', 'XF86Display']
['<Super>p', 'XF86Display']
org.gnome.settings-daemon.plugins.media-keys rotate-video-lock-static ['<Super>o']
org.gnome.settings-daemon.plugins.media-keys touchpad-toggle-static ['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle']
org.gnome.shell.extensions.dash-to-dock shortcut-text '<Super>q'

With dconf-editor I've managed to disable the first one, but I can't find the others. Doing it with the point-and-click approach of dconf-editor is a pain. Do you know how to disable these keybindings from terminal?

1
0

Thank you very much for your answer, @amitp. Thanks to it I've discovered the culprits for all the interceptiion but one: Alt-!! (I've searched for Alt but can't find any combination with !. However, Meta-! doesn't work in Emacs):

org.gnome.mutter.keybindings switch-monitor ['<Super>p', 'XF86Display']
['<Super>p', 'XF86Display']
org.gnome.settings-daemon.plugins.media-keys rotate-video-lock-static ['<Super>o']
org.gnome.settings-daemon.plugins.media-keys touchpad-toggle-static ['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle']
org.gnome.shell.extensions.dash-to-dock shortcut-text '<Super>q'

With dconf-editor I've managed to disable the first one, but I can't find the others. Doing it with the point-and-click approach of dconf-editor is a pain. Do you know how to disable these keybindings from terminal? Thank you very much again!

Another answer re-directed me to

https://stackoverflow.com/questions/39785698/keyboard-shortcuts-file-gnome

My final answer

Great, thanks everyone for your help. So to recap:

$ gsettings list-recursively | grep Super

got me the list of commands that use super in their keybindings. For example:

org.gnome.mutter.keybindings switch-monitor ['<Super>p', 'XF86Display']
['<Super>p', 'XF86Display']
org.gnome.settings-daemon.plugins.media-keys rotate-video-lock-static ['<Super>o']
org.gnome.settings-daemon.plugins.media-keys touchpad-toggle-static ['XF86TouchpadToggle', '<Ctrl><Super>XF86TouchpadToggle']
org.gnome.shell.extensions.dash-to-dock shortcut-text '<Super>q'

Then

gsettings set org.gnome.settings-daemon.plugins.media-keys rotate-video-lock-static "[]"

Deleted the <Super>o binding for rotate-video-lock-static, etc.

The only strange thing is that M-! has started working in Emacs without me changing anything in Ubuntu/Gnome directly related to it.

Also, I have super-@ bound to something in Emacs and it seems to be intercepted by some command in Ubuntu/Gnome. However, it does not appear in the list given by gsettings list-recursively | grep Super, or at least I can't recognize it. Is the @ symbol referred to by some kind of weird code or name by Ubuntu/Gnome maybe?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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