atom/atom-keymap

Atom confused by non-default keyboard layout and hijacks system keybinding

Opened this issue · 0 comments

Prerequisites

(the FAQ link appears broken)

Description

On OSX, with the default keyboard layout, cmd + ` works to toggle between open Atom windows (it toggles between any open windows of the current application as a system keybinding). When switching from British (default) to British PC keyboard layout, which swaps the backquote and the backslash, Atom continues to view cmd + ` as cmd+\ and refuses to toggle between the atom windows.

Steps to Reproduce

  1. Switch keyboard on OSX from default British (similar to US) to British PC, swapping the backlash and backquote
  2. The cmd + ` "toggle between windows of the same application" system keybinding stops working

Expected behavior:

I can continue to toggle between Atom windows

Actual behavior:

I completely lose the toggle between windows functionality, making atom a bit useless

Reproduces how often:

100% of time

Versions

Atom : 1.58.0
Electron: 9.4.4
Chrome : 83.0.4103.122
Node : 12.14.1

macOS Monterey
Version 12.1
Macbook Pro
Chip Apple M1 Pro

Additional Information

I tried setting both keybindings to unset in keymap.cson but to no avail:

'.platform-darwin atom-text-editor .tree-view':
  'cmd-\\': 'unset!',
  'cmd-`': 'unset!'
'.platform-darwin':
  'cmd-\\': 'unset!'
  'cmd-`': 'unset!'

I also tried to unify how atom views the key using the init.coffee script:

atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'Backquote' and event.metaKey
    return 'cmd-\\'
atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'Backslash' and event.metaKey
    return 'cmd-\\'
atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'IntlBackslash' and event.metaKey
    return 'cmd-\\'

Nothing works.

The key binding resolver shows atom recognises the keybinding as unset, but it won't give it up to the system one. I tried abort and native also, and none of them worked.

Screenshot 2022-01-21 at 10 24 01

Ultimately, I don't care how this is resolved, whether by getting Atom to stop hijiacking the keybinding, or by setting the keybinding in atom (but I couldn't find that functionality).

I'm probably not seeing something obvious, but...

Update

Also tried setting

atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'Backquote' and event.metaKey
    return 'cmd-`'
atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'Backslash' and event.metaKey
    return 'cmd-`'
atom.keymaps.addKeystrokeResolver ({event}) ->
  if event.code is 'IntlBackslash' and event.metaKey
    return 'cmd-`'

And removing stuff from keymap.cson -- result is Atom keybinding resolver shows cmd + ` and no rules associated with it, but system behaviour still doesn't work.