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

allow use of linux Super key for shortcuts #2524

Open
brotherJ4mes opened this issue Nov 9, 2024 · 1 comment
Open

allow use of linux Super key for shortcuts #2524

brotherJ4mes opened this issue Nov 9, 2024 · 1 comment

Comments

@brotherJ4mes
Copy link

I love everything about Min. Great functionality; very sleek.

I can easily find how to set custom shortcuts on the settings page but as far as I can tell, the only recognized modifiers are "ctrl" and "alt" (which map to "mod" and "option", respectively in the settings.json file)

I attempted to write in "super" as a short cut (e.g. super+t for new tab) but it didn't seem to register.

I also tried "meta" since that's how the super key is recognized in Vivaldi and "m" which is used for super in Chromium.

Is using the Super key currently possible in Min?

Would it be feasible to implement?

Could one develop a userscript to make it work or are modifiers too "low level"?

@PalmerAL
Copy link
Collaborator

PalmerAL commented Dec 1, 2024

I looked at this a little bit, and I'm not sure what would be needed to support this. Internally, Min has two separate keyboard event handlers, depending on which part of the UI you're in:

The first is Mousetrap - I think the Linux super key would be equivalent to the Windows key, but that apparently isn't supported, and it wasn't added because "Unfortunately this means it is not going to be a simple thing to add to the core library since the windows key is not treated as meta, shift, ctrl, or alt" (ccampbell/mousetrap#81)

The usage of Mousetrap is mostly just a leftover legacy thing - it would make sense to refactor everything to use the Electron input system, which we also use in some places. If we did that, then these docs apply: https://www.electronjs.org/docs/latest/api/web-contents#event-before-input-event

That page doesn't mention the super key specifically, but the linked keyboardEvent.metaKey docs say:

Returns a boolean value that is true if the Meta key (on Mac keyboards, the ⌘ Command key; on Windows keyboards, the Windows key (⊞)) was active when the key event was generated.

Which seems to contradict what the Mousetrap issue says.

I only have Apple keyboards to test this on (so nothing with a super key), but if you have time, could you try this?
Inside this function, add console.log(input): https://github.com/minbrowser/min/blob/master/js/keybindings.js#L121

Then, while the keyboard focus is in the browser UI (like the searchbar, not a webpage), try pressing super+any key, copy the resulting input object from the devtools, and paste it here.

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

No branches or pull requests

2 participants