Closed rdinse closed 6 years ago
@rdinse Hi! Check the logs from the Console app. I presume it has been registered by the system or by some other app.
I've disabled USB Overdrive and Karabiner-Elements (the only programs with global keyboard bindings that I am aware of) and I checked all shortcuts in the system's keyboard settings. It still does not work. The curious thing is also that ctrl-1
appears to be passed through completely normally, at least according to Emacs (it captures it as C-u 1-
as expected) and Karabiner's event viewer (key_down 0xe0 left_control, key_down 0x1e 1, key_up 0xe0 left_control, key_up key_down 0x1e 1
). So it does not seem to be registered by any app.
@rdinse Looks like the system registers ctrl + 1...n
for switching between Spaces. By default you only have one space. You can disable this under the Keyboard shortcut preferences in System Preferences.
Key.on('1', [ 'ctrl' ], () => Phoenix.log('ctrl + 1'));
Key.on('2', [ 'ctrl' ], () => Phoenix.log('ctrl + 2'));
If you check the logs, Phoenix emits an error when trying to bind ctrl + 1
. The error code -9878 represents the case where the hot key already exists and cannot be bound again.
2018-06-13 21:53:10.956886+0300 Phoenix[3567:289265] Error: Could not register key 18 (0) with modifiers 4096. (-9878)
2018-06-13 21:53:10.958290+0300 Phoenix[3567:289265] Context loaded.
2018-06-13 21:53:24.697384+0300 Phoenix[3567:289265] ctrl + 2
Interesting, thanks, but it does not work. I am getting the same message:
default 23:15:10.442205 +0200 Phoenix Error: Could not register key 18 (95) with modifiers 4096. (-9878)
The ^1 shortcut in Settings > Mission Control > Mission Control > Switch to Desktop 1 was already disabled. Enabling & re-disabling it did not help. Does it work on your machine?
Ah, right. It seems if you disable the setting, other system apps register the same shortcut for other purposes. I suggest you use additional modifiers in this case.
This seems to be a bug in macOS: https://apple.stackexchange.com/questions/135814
I found a workaround by binding the Spaces to shift+^[number] and then disabling them. ¯\_(ツ)_/¯
Thanks anyway.
Haha, glad you got it sorted out!
On my machine, the code above works for
crtl-2
, but not in case ofctrl-1
.