So firstly, I assume you mean you've set your Windows key to do nothing in AHK with something like: LWin::Return
. If this is the case, the Windows menu certainly shouldn't be opening in Emacs.
If you are trying to disable a single keypress of the Windows key in emacs, you should be able to simply set (setq w32-pass-lwindow-to-system nil)
. I've tested this to work under Windows 10 64bit. Similarily, you can assign the above AHK function to only operate for an Emacs Window.
Alternatively, If you are trying to get the Windows key to act as an additional modifer within Emacs, the answer is less straightforward.
In short, it is not possible to get Windows Key to act as super in all contexts through Emacs configuration alone. While you can (setq w32-pass-lwindow-to-system nil)
and (setq w32-lwindow-modifier 'super
), enabling the functionality for Windows key to act as super — Windows will still intercept any core OS function keystroke (e.g., Win + D
to escape to desktop). Thus, you can make Windows key alone not perform anything within Emacs (i.e., not open the menu); and you can assign super commands to any combination which isn't already bound by Windows.
For example, you'll notice that unbound strokes, such as Win + '
will not be intercepted and sent to Emacs. The example snippet below shows that you can assign Win + ]
to a command within Emacs.
(setq w32-pass-lwindow-to-system nil
w32-lwindow-modifier 'super) ;; Menu key
(defun super-test ()
(interactive)
(message "Super"))
(global-set-key (kbd "s-]") 'super-test)
C-h c
say anything useful for the <Win> key? On Linux, that key is intercepted by the desktop environment before emacs gets a chance to see it.view-lossage
(bound toF1 l
by default) to see whether something has registered. Emacs ignores modifier keys by themselves, and windows might be intercepting some keystrokes, which would make your problem related to the operating system and not Emacs itself.