2

I use Windows 10's virtual desktop feature. The hotkey for switching between virtual desktops is Ctrl-Win-Left / Ctrl-Win-Right. When Emacs is focused and I want to switch dekstops, I get an error message in Emacs: "<C-lwindow> is undefined" and an alarm sound is played. I don't mind the error message that much, but the sound is quite irritating. Is there a way to tell Emacs to ignore this key combination?

2
  • I don't use Windows, but I would have expected the key sequence to reach Emacs only if the window manager had ignored it. The idea of it working the other way around (key sequences only reaching the window manager if the current application ignores them) sounds very odd (e.g. it would presumably then become simple for an application to prevent the user from switching applications). As such, you might find it's not an Emacs issue at all.
    – phils
    Commented Mar 5, 2018 at 12:16
  • 1
    I have a feeling that the issue might have to do with Windows interpreting Ctrl-Win as a modifier (as it expects a Left/Right key in addition to that), while Emacs seems to view Ctrl-Win as a key combination already: Emacs errors when I press Ctrl-Win, and Windows switches desktops once i add the Arrow button, so it seems that these are two separate key sequences somehow.
    – werki
    Commented Mar 5, 2018 at 12:20

1 Answer 1

3

I managed to remove the error by adding (global-set-key (kbd "<C-lwindow>") 'ignore) to my Emacs config file.

1
  • Thank you for figuring this out! It seems like a minor irritation at first, but it happens so often that it gains in magnitude considerably over time.
    – Chrisuu
    Commented Mar 1, 2021 at 15:52

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.