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
Feature request: Add support for modifier keys like right ctrl and right alt #44697
Comments
possible code pointer? |
Came here because I'm running out of available key combinations to use as shortcuts :) This would allow me to pretty much double it. It's definitely possible to differentiate between them as shown here: https://w3c.github.io/uievents/tools/key-event-viewer.html Also, add right shift and to the list! And maybe we could have NumpadEnter bindable aswell? |
Any update on this request? |
Is very interesting feature request. |
I think this feature is almost out of scope. However, this feature could be implemented by a separate tool, independent of VS Code. |
The usage of an external tool to fix this issue sounds like an absolute workaround. |
With autohotkey, you can only rebind to other keys, you can't just send a command. But what if other keys are taken? that's the main reason I want VSCode to add support for differentiating modifiers. I've run out of shortcuts to use :( If I'd use AHK for this, I'd have to simulate multiple keypress shortcuts like And even if this was a pratical and comfortable workaround, what about other systems? ahk is windows only, and I also develop on linux, sometimes mac. Do I have to look for alternatives on each platform, and configure and maintain these setups everywhere? The data about the key is already available on every key event, why can't vscode just use it? If I press I don't understand the push back here, or the claims that this usability improvement and extending what is possible with shortcuts is out of scope. Is improving vscode not in the scope? |
You could use F13-F24, including various combinations with ctrl and shift. |
I don't really understand the point of mapping existing keys to possibly "virtual keys" that can be watched by the Window Manager for other custom user shortcuts. Plus, those keys actually exist on older IBM keyboards. Considering what you proposed for those who use them makes another fabricated problem, solving nothing, in practice. |
Would it be better to start by just allowing users to specify keycodes in the shortcuts json? Might fix some issues for international keyboards as well? Or a distinct {
"name": "Right Alt",
"key": "Alt",
"Location": "2"
} or {
"name": "Right Alt",
"code":"AltRight"
} Then the shortcuts UI could check it an entry is displayed in |
I believe this is also an interesting approach for custom non-standard keycodes, although I do think this is a separate feature, since Right Alt is a fairly common modifier and doesn't deserve a custom configuration, IMO. |
A thing to solve here is to help extension authors avoid some key bindings that would become available. For instance, I don't have a right ctrl key on my keyboard (a MacBook Pro). And since it is also a Swedish layout, I already have enough problems with some VS Code built-ins shortcut defaults. |
I'm here because I'd love to get support for NumpadEnter as distinct from Enter. I blame TextMate for training me this way so many years ago by binding NumpadEnter — or Fn + Return on Mac laptops — to several useful sorts of commands. It's such a convenient way of expressing “like Enter, only more so” in various contexts. Imagine using NumpadEnter
I could see treating Enter and NumpadEnter identically in spreadsheet software, but I can't justify an expectation that they do the same thing in an IDE. I know I'm the weird one in the room, but I think this could at least be controlled by a setting so that I could opt into the tradeoff. Or an extension hook of some sort would be great, too; Atom lets me fix this with a couple lines of code in my init file. |
unfortunatley afaik that's another brokey key API, it doesn't differentiate between left/right key modifiers in a combo, only when you press them as non-modifier keys, you'd need some not-fully-reliable listener/tracker of previous events (which may happen outside of your app, so you'd miss them) |
then you'd lose all the direct hints in the app and have to remember/lookup what is mapped to what. Also it's not x-platform unlike native support, so you'd have to duplicae work So this approach is very unergonomic, although it beats having nothing |
In what way is keyboard shortcut handling for an application that supports keyboard shortcuts remotely out of scope? Genuinely asking, because I'm not parsing the logic here. I would think this fits the stated goals of the project without need for further evaluation. The current behavior undesirably (for many) merges the assignment of multiple keys. There could very easily be a toggleable setting that determines whether these sorts of keys are merged.
Wouldn't that also trigger the built-in
Does it seem reasonable for an application with keyboard shortcuts to support F13-F24 -- keys not on a typical keyboard -- but not support Right Ctrl, Right Shift, Right Alt, Numpad Enter, etc. -- keys generally on both full ANSI and ISO keyboards? Again, I am genuinely asking. This seems to fall firmly within the precise definition of a workaround. |
Requesting this reminds me a lot of this xkcd comic, but hey... I'm trying to bind my right alt key ( |
You can see in [1, ScanCode.ControlLeft, 'ControlLeft', KeyCode.Ctrl, empty, 0, 'VK_LCONTROL', empty, empty],
[1, ScanCode.ShiftLeft, 'ShiftLeft', KeyCode.Shift, empty, 0, 'VK_LSHIFT', empty, empty],
[1, ScanCode.AltLeft, 'AltLeft', KeyCode.Alt, empty, 0, 'VK_LMENU', empty, empty],
[1, ScanCode.MetaLeft, 'MetaLeft', KeyCode.Meta, empty, 0, 'VK_LWIN', empty, empty],
[1, ScanCode.ControlRight, 'ControlRight', KeyCode.Ctrl, empty, 0, 'VK_RCONTROL', empty, empty],
[1, ScanCode.ShiftRight, 'ShiftRight', KeyCode.Shift, empty, 0, 'VK_RSHIFT', empty, empty],
[1, ScanCode.AltRight, 'AltRight', KeyCode.Alt, empty, 0, 'VK_RMENU', empty, empty],
[1, ScanCode.MetaRight, 'MetaRight', KeyCode.Meta, empty, 0, 'VK_RWIN', empty, empty], Why this s done I don't know. |
Issue Type
Feature Request
Description
Currently VS Code treats left and right modifier keys as the same one (ctrl, alt and shift).
I want to define different keyboard shortcuts for left and right modifier keys (e.g. left ctrl + s for saving files, and right ctrl + s for something else), but unfortunately this cannot be done.
VS Code Info
VS Code version: Code 1.20.0 (c63189d, 2018-02-07T17:10:15.949Z)
OS version: Linux x64 4.14.16-300.fc27.x86_64
The text was updated successfully, but these errors were encountered: