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?

  • 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 Mar 5 '18 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 Mar 5 '18 at 12:20

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

| improve this answer | |

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.