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

Using capslock in a keybinding still toggles capslock #13312

Closed
billti opened this issue Oct 6, 2016 · 8 comments
Closed

Using capslock in a keybinding still toggles capslock #13312

billti opened this issue Oct 6, 2016 · 8 comments
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities keybindings VS Code keybinding issues *out-of-scope Posted issue is not in scope of VS Code

Comments

@billti
Copy link
Member

billti commented Oct 6, 2016

  • VSCode Version: 1.5.3 (also tried with today's 1.6.0-insider build)
  • OS Version: Win 10

Steps to Reproduce:

  1. Open the keybinding preferences
  2. Map the capslock key to a command (e.g. {"key": "capslock", "command": "workbench.action.showCommands"}
  3. While editing, using capslock to trigger the command, and observe that it fires.
  4. Continue typing in the editor and observe capslock is now on.

Expected

Capslock should not be passed through and toggle caps-lock in the editor if it is mapped to a command. (Capslock is often mapped to exiting Insert mode in Vim setups, as it's far closer than the Escape key).

See also related VSCodeVim/Vim#854 .

@Tyriar Tyriar added feature-request Request for new features or functionality keybindings VS Code keybinding issues labels Oct 7, 2016
@billti
Copy link
Member Author

billti commented Oct 8, 2016

Just realized this may not be (trivially) possible due to how Windows deals with Caplock (e.g. http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows ).

@ghost
Copy link

ghost commented Oct 11, 2016

One guy did a fantastic job remapping the caps-lock key on Windows.

https://github.com/mjvh80/SymWin

SymWin has no relation to VSCode by any means, but I just wanted to show that you don't have to edit Registry values.

I use SymWin to write German umlauts on my US English keyboard because the German layout is pretty much sh*t for programming tasks.

@alexdima alexdima removed their assignment Oct 27, 2016
@alexdima alexdima added this to the Backlog milestone Oct 27, 2016
@alexdima alexdima added the help wanted Issues identified as good community contribution opportunities label Oct 27, 2016
@alexdima
Copy link
Member

I believe this is outside of our control, except perhaps if we write a C++ module that does some magic. At our level we call e.preventDefault(), but the "caps gets locked" regardless.

@GitMensch
Copy link
Contributor

I see that it is possible to contribute a keybinding and that we could also use capslock there. Is there also an option to actually toggle it (back) from within the extension and/or get the capslock state?

@alexdima alexdima modified the milestones: Backlog, Backlog Candidates Oct 18, 2021
@alexdima alexdima added the *out-of-scope Posted issue is not in scope of VS Code label Oct 18, 2021
@alexdima alexdima removed this from the Backlog Candidates milestone Oct 18, 2021
@microsoft microsoft deleted a comment Oct 18, 2021
@GitMensch
Copy link
Contributor

@alexdima Do you have a clue if it is possible to toggle capslock (back) from within an extension and/or get the capslock state? If this would be the case an extension could handle that.

@alexdima
Copy link
Member

alexdima commented Oct 19, 2021

@GitMensch The initial problem remains. We don't have a way to prevent a CapsLock press from triggering CapsLock. I think this might be doable with C++, by sending fake events to the OS to toggle CapsLock back or something like that. But that is outside of the scope of VS Code, we try to interpret what was pressed and it is not in our scope to implement key code swapping (esc <-> capslock). I think an OS level solution needs to be found for swapping escape and capslock. Maybe there is software that you can install and would swap this for you.

@dustinroepsch
Copy link

incase anyone is looking for the OS level solution:
https://vim.fandom.com/wiki/Map_caps_lock_to_escape_in_Windows

@bosmak
Copy link

bosmak commented Jul 20, 2023

If anyone is looking for yet another solution.

Using PowerToys on their Keyboard Manager, you can remap CapsLock to Esc.

It is also helpful if you want to turn off any shortcut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities keybindings VS Code keybinding issues *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

8 participants
@billti @Tyriar @alexdima @dustinroepsch @GitMensch @bosmak and others