Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Allow Alt-key bindings to override menus. #474

Closed
mkleehammer opened this issue Jul 10, 2014 · 19 comments · Fixed by #585
Closed

Windows: Allow Alt-key bindings to override menus. #474

mkleehammer opened this issue Jul 10, 2014 · 19 comments · Fixed by #585

Comments

@mkleehammer
Copy link

@mkleehammer mkleehammer commented Jul 10, 2014

On Windows, top-level menu items like "&File" always process their hotkeys - after the menu is dismissed the bound behavior then executes. For example, if Alt-f is bound to a "forward word command" (similar to bash, emacs, etc.), the File menu drops down. After the file menu is dismissed with Esc the cursor will move forward.

Since there are many basic readline-style keybindings that conflict, this can be a show-stopper for some.

@dkleehammer

This comment has been minimized.

Copy link

@dkleehammer dkleehammer commented Jul 10, 2014

+1 watching this issue.

@rjattrill

This comment has been minimized.

Copy link

@rjattrill rjattrill commented Nov 20, 2014

I am not sure if this is really fixed. Version 0.150.0 on Windows does not process Alt-f in the proposed manner outlined by @mkleehammer. Instead Alt-f is bound to "forward word command" and the menu although highlighted cannot be accessed from keyboard.

@rjattrill

This comment has been minimized.

Copy link

@rjattrill rjattrill commented Nov 20, 2014

The workaround is to put this in keymaps.cson:

'atom-text-editor':
   'alt-f': 'native!'
@anaisbetts

This comment has been minimized.

Copy link
Contributor

@anaisbetts anaisbetts commented Nov 20, 2014

This is also kind of an Atom bug, as you really shouldn't have Alt+X shortcuts on Windows, in General. That's Weird™

@rjattrill

This comment has been minimized.

Copy link

@rjattrill rjattrill commented Nov 27, 2014

If I am re-reading the original issue correctly I believe now that that @mkleehammer wants Alt-f to bind to 'forward word command' before '&File' from the menu. So my earlier comment that this was not fixed is wrong. However, I agree with @paulcbetts - Alt-F mapping to 'forward word command' is not the default behaviour that most windows users would expect.

It looks like keymaps.cson can contain platform specific sections. (See for example: diiq/atomatigit@9e8cf03) I am tempted to create an issue or pull request to remove the Alt+X bindings for Win32 platform. Please comment if that is not a good idea.

@anaisbetts

This comment has been minimized.

Copy link
Contributor

@anaisbetts anaisbetts commented Nov 27, 2014

@rjattrill I think that's a good idea, please do!

@ZiaMM

This comment has been minimized.

Copy link

@ZiaMM ZiaMM commented May 27, 2015

I am on Linux, where some of us also use modern keymappings which accompany "drop down menus" at the top of "windows". I also expect "Alt-F" to bring down the "File Menu". Pressing "s", after that, should save my work.

The way I fixed this problem, with an older version of atom-editor, was to delete the emacs.json file (under “resources\apps\keymaps"). Now that file is no longer there, and modifying "keymaps.cson" seems to only work "for a little while", then revert to the "default" mapping (1970s terminal style).

I am guessing that the "default" keymap is still coded in some file I can dispose of ... but where? Alternatively, is there a "reload keymap file" command which I could use in place of a restart?

@Mingling94

This comment has been minimized.

Copy link
Contributor

@Mingling94 Mingling94 commented Jun 4, 2015

I'm on Ubuntu Gnome 15.04

I have the same issue as ZiaMM, I want my Alt-F to bring down the File Menu without having to select it by mouse. Pressing Alt to bring down a menu toggled to be hidden or even pressing Alt when the menu is shown underlines the 'F' in 'File' implying that it can be selected through pressing 'F'

However, it just does forward word :(

I'd like to not have to edit files and have these keymappings customizable through more graphical routes like the menu.

@phillipwei

This comment has been minimized.

Copy link

@phillipwei phillipwei commented Jun 25, 2015

I'm on windows. This was terribly confusing.

@rjattrill I think what you are suggesting is perfect.

@rjattrill

This comment has been minimized.

Copy link

@rjattrill rjattrill commented Jun 26, 2015

Pull request #7434 submitted

@ZiaMM

This comment has been minimized.

Copy link

@ZiaMM ZiaMM commented Jul 11, 2015

Please allow Linux users to also enable standard drop-down menu functionality. This is present on every other GUI application I use on my Linux-OS PC. Atom is the exception to the rule. We should be able to access the "File" menu by pressing Alt-F, along with Windows-OS users. Thanks.

@rjattrill

This comment has been minimized.

Copy link

@rjattrill rjattrill commented Jul 13, 2015

What is the standard for OS X? If it is the same across OS X, Linux and Windows then the approach in my pull request might not be correct.

@dkleehammer

This comment has been minimized.

Copy link

@dkleehammer dkleehammer commented Jul 17, 2015

@rjattrill & @paulcbetts

What @mkleehammer (as well as myself) is trying do is to have a custom keymap as we like it... weird or not for you, many of us work on multiple platforms in a day (personally, I'm on windows and OSX) and come from an emacs world, so mapping my keys to emacs style of keys works best for me as I'm not having to think about what platform I'm on, but rather It Just Works™. Processing the keymap before the applications hot-keys will enable atom to be a high custom IDE specific to the user.

@rjattrill - Ross, I don't see pull-request #7343, so I'm unable to tell you the approach is correct.

@frankhale

This comment has been minimized.

Copy link
Contributor

@frankhale frankhale commented Jul 17, 2015

@dkleehammer, the pull request is here: atom/atom#7434

@mn4367

This comment has been minimized.

Copy link

@mn4367 mn4367 commented Jul 25, 2015

@rjattrill

What is the standard for OS X? If it is the same across OS X, Linux and Windows then the approach in my pull request might not be correct.

There is no equivalent to Alt+* to open a menu on OS X. The standard way on OS X to reach the application menu is Ctrl+F2, after that you can go to menu entries by entering the first letter of the name of the desired menu entry or by using the cursor keys.
Just a note on your pull request, if Atom should be localized in the future, ALt+F of course won't work in every other language, so maybe for this kind of 'overrides' it's worth considering a solution which allows localization.

@uptownhr

This comment has been minimized.

Copy link

@uptownhr uptownhr commented Nov 2, 2015

I'm on ubuntu using emacs bindings, and going back to the original poster, can alt be disabled from toggling the menu?

@akappen

This comment has been minimized.

Copy link

@akappen akappen commented Dec 16, 2015

@uptownhr

I'm also on Ubuntu and really hate the alt menu shortcuts. Here's a way to disable them for the Atom editor, tested on versions 1.0.0 - 1.3.1.

https://discuss.atom.io/t/alt-key-menu-bar-interaction-overrides-shortuts/9192/7

Add this to your Atom init script:

# Get rid of the alt-menu shortcuts
atom.menu.template.forEach (t) ->
  t.label = t.label.replace("&", "")
atom.menu.update()
@uptownhr

This comment has been minimized.

Copy link

@uptownhr uptownhr commented Jan 18, 2016

@akappen thanks, I will check this out and report any issues.

@ElijahLynn

This comment has been minimized.

Copy link

@ElijahLynn ElijahLynn commented May 2, 2017

@akappen On Ubuntu 14.04 here and I have alt menu shortcuts disabled but for some reason Slack (electron) has my overridden my override. I initially thought it was a Gnome 2 vs Gnome 3 thing but your comment has given me some hope. I am currently trying to find out how to do the same as you did for Slack.

update: Slack customer service says there is no way to do it. https://twitter.com/SlackHQ/status/859449588285046784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

You can’t perform that action at this time.