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

alt-key menu bar focus interference #95

Open
1 task done
wlwl2 opened this issue Oct 23, 2022 · 3 comments
Open
1 task done

alt-key menu bar focus interference #95

wlwl2 opened this issue Oct 23, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@wlwl2
Copy link

wlwl2 commented Oct 23, 2022

Have you checked for existing feature requests?

  • Completed

Summary

I'm bringing an issue that Electron had into here (for a long time) to track its development.
electron/electron#34211 (comment)

I'm not sure about this but I read somewhere that Pulsar was open to allowing the menu bar to be hacked (and therefore every part of the editor)? This would then be covered when that is considered as well.

Enter your response below:

Many people are having this issue, there were about 5 or 6 issues that I saw over multiple repos Electron, Atom. These ranged from language switching issues because of this new feature, important keyboard shortcuts causing issues, and just pressing the alt-key alone causing the menu bar to be focused accidently.

Any alternatives?

VSCode has settings to adjust this, but Atom doesn't. Not sure about Pulsar. See the last comment on the issue referenced.

Other examples:

This was a new update at some point causing the problem with Electron. VSCode has settings to adjust this.

@wlwl2 wlwl2 added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 23, 2022
@confused-Techie
Copy link
Member

Sorry there was never an original response on this issue. But thanks a ton for reporting it!

Looking at the linked issue, it seems it has never been addressed by Electron maintainers and is still open. Meaning we have only a single way to change it, (which is the same way VSCode does) and that's to not use a native title bar at all.

Which that is a whole other complication into matters, but has been discussed other places as a potential solution, so there may be a lot of validity into pursuing this more, such as #442 and #345

@mauricioszabo
Copy link
Contributor

mauricioszabo commented Sep 29, 2023

So, if anyone wants to implement this, here are some guidelines:

All menus are defined natively in Electron, on the Main Process, at this file: src/main-process/application-menu.js

It's called via an IPC message called 'update-application-menu', defined at line 877 of src/main-process/atom-application.js. Finally, it is exposed as an API to the renderer process at src/menu-manager.js.

So, it's not that hard to fix - you just will need to make a "pure CSS + HTML" menu, and then instead of calling the IPC message, just update the UI with the relevant "new menu". The "good news" is that the IPC message always sends the full menu - meaning that you won't need to do any "diff" or whatever other stuff, you can literally destroy and reconstruct everything, everytime, and it'll work - here's an example on how the menu structure is sent via the IPC message:

image

Hopefully that helps :)


UPDATE: remember that menus can have keystrokes, so you'll probably need to add them at the keymaps too, and remove them when the menu is invalidated.

@asiloisad
Copy link
Contributor

asiloisad commented Sep 29, 2023

the easiest workaround is set new keymap for pure alt with any random text... like:

'*':
  'alt': 'miss'

An option in setting to inject this chunk into keymap will make it easier for users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants