Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Backspace does not work with Colemak keyboard layout #192

Closed
MattKang opened this issue Dec 1, 2016 · 19 comments
Closed

Backspace does not work with Colemak keyboard layout #192

MattKang opened this issue Dec 1, 2016 · 19 comments

Comments

@MattKang
Copy link

MattKang commented Dec 1, 2016

I use the Colemak layout as my primary input method on Windows 10. This layout remaps the caps lock key as backspace. Keymap does not recognize this remapping, and the backspace functionality does not work.

Expected Behaviour:
Press Caps Lock key to produce Backspace

Observed Behaviour:
Press Caps Lock key without result. When I press the Caps Lock key, the Key Binding Resolver recognizes it as Caps Lock (instead of Backspace) but does not toggle caps lock on/off.

I have noticed this since v1.12 of Atom. I am using the Colemak layout as provided here.

@Ben3eeE
Copy link
Contributor

Ben3eeE commented Dec 1, 2016

Can you post the results of typing caps lock after running the following devtools console script:

document.addEventListener('keydown', e => console.log(e), true)

@ghost
Copy link

ghost commented Dec 1, 2016

Here you go:

test

Interesting observation: control + caps lock does work in the developer tools console. It doesn't in the text editor, though.

@MattKang
Copy link
Author

MattKang commented Dec 1, 2016

Yes I can confirm that Caps Lock as Backspace also works in the developer tools console but not the text editor. My results from keydown listener (practically identical):
capture

@Ben3eeE
Copy link
Contributor

Ben3eeE commented Dec 1, 2016

For some reason the key and code fields are incorrectly resolved as CapsLock. Which confuses Atom because we use these fields when we resolve keys.

You should be able to work around this issue using the public keystroke resolver API. If you try something like this in your init.coffee to make Ctrl-CapsLock resolve as backspace.

atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.key is 'CapsLock' and event.keyCode is 8 and event.ctrlKey and event.type is 'keydown'
    return 'backspace'

@MattKang
Copy link
Author

MattKang commented Dec 1, 2016

Thanks @Ben3eeE

For the time being, I have achieved satisfactory behaviour from the following:

atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.key is 'CapsLock' and event.keyCode is 8 and !event.ctrlKey and event.type is 'keydown'
    return 'backspace'
  if event.key is 'CapsLock' and event.keyCode is 8 and event.ctrlKey and event.type is 'keydown'
    return 'ctrl-backspace'

Not really familiar with coffee, so hopefully this syntax is correct.

@Ben3eeE
Copy link
Contributor

Ben3eeE commented Dec 15, 2016

Hey, I tried to repro this on Ubuntu to see if we could add the workaround into atom-keymap and I was unable to reproduce the issue using Atom 1.12.7.

@Gert-dev Did you only see this on Linux with the Ctrl modifier? If so it is possible that this was fixed in Atom 1.12.7 with the Ctrl modifier fix. Can you test it out and see if it works for you with the latest version?

@MattKang How did you install the colemak layout?

@ghost
Copy link

ghost commented Dec 15, 2016

@Ben3eeE Thanks for the tip, I can confirm that the issue is fixed for me in Atom 1.12.7. Atom 1.12.6 still requires the fix listed by @MattKang specified above.

@MattKang
Copy link
Author

@Ben3eeE Just updated to Atom 1.12.7, and the issue persists for me. I installed the Colemak layout via colemak.com. I use Version with Caps Lock as Backspace.

@MattKang
Copy link
Author

@50Wliu

Atom    : 1.12.7
Electron: 1.3.13
Chrome  : 52.0.2743.82
Node    : 6.5.0

@JustinLewisSMA
Copy link

Hi! I just installed 1.13.0 ia32 today and the Colemak caps issue exists.

@Aoriseth
Copy link

I'm also unable to use the Colemak caps backspace in windows 10 using v1.15.0 x64

@MattKang
Copy link
Author

MattKang commented May 2, 2017

Updated temporary init.coffee fix:

atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.key is 'CapsLock' and event.keyCode is 8 and event.type is 'keydown'
    return 'backspace'
  if event.key is 'Delete' and event.keyCode is 8 and event.ctrlKey and event.type is 'keydown'
    return 'ctrl-backspace'

Fixes Ctrl+Backspace in v1.16.0.

@Ben3eeE
Copy link
Contributor

Ben3eeE commented Sep 8, 2017

@MattKang Atom 1.19 upgraded Electron which might have resolved this issue for you. Can you confirm if it is working when using Atom 1.19 without the workaround or do you still see the same issue?

@BowenWang
Copy link

Hi all,
I just downloaded the Atom editor from atom.io and install. I have a pretty similar issue. I use xmodmap to remap my CapsLock key to Backspace, and Backspace to Tab. It works in my linux.
But when I tried to use the Atom, I found that both Capslock(remap to Backspace in my system) and Backspace(remap to Tab in my system) are interpreted as Backspace.

Anyone knows how I can fix it?

Bowen

@MattKang
Copy link
Author

@Ben3eeE It appears this Backspace issue has been resolved! On Atom 1.19.3, and Backspace appears to function correctly without the use of the workaround.

@BowenWang
Copy link

@MattKang Do you know how I can fix the problem I mentioned above?

@MattKang
Copy link
Author

@BowenWang The init.coffee fix I posted previously may work for you but will require editing.

To figure out what key commands are actually being triggered, you need to run this devtools console script:
document.addEventListener('keydown', e => console.log(e), true)

All the best!

@BowenWang
Copy link

@MattKang All right, I will try it. Thanks!

Bowen

@Ben3eeE
Copy link
Contributor

Ben3eeE commented Sep 11, 2017

@BowenWang If you need help to write the function you can ask on Discuss or the Atom slack.

On Discuss and in the Atom Slack team, there are a bunch of helpful community members that should be willing to point you in the right direction.


I'm going to close this issue out because it has been resolved with the Electron upgrade 🎉

@Ben3eeE Ben3eeE closed this as completed Sep 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants