Skip to content

Bug: brdown brup work inconsistently in macos #1726

@justin-calleja

Description

@justin-calleja

Requirements

Describe the bug

I apologise if this is "keyboard hardware limitation to save costs" - I don't know how to confirm whether it's the case or not.

I think it's not because with karabiner event viewer running, I can get:

  {
    "type": "down",
    "name": {"consumer_key_code":"display_brightness_increment"},
    "usagePage": "12 (0x000c)",
    "usage": "111 (0x006f)",
    "misc": "flags left_command,left_control,left_option,left_shift"
  },

showing that the brightness increase input has been detected by an application. However, kanata does not increase the brightness when I hold "space + s" and press f.

It does work if I use brup in the base layer.

In debug.kbd (given below), brdown/up in home row or top row don't work but VolumeDown/Up do.
Also, in base layer, everything works (I haven't tried the media ones).

In debug2.kbd I added a system2 layer with just the ; key being pressed and now brightness works. So it's a key combination issue (hardware level signal not sent when "space + s" then press f... is not sending signal. But then how come karabiner event viewer is correctly picking up the brightness up when i have debug.kbd running kanata and I hold "space + s" and press f. It outputs the JSON above with "brightness increment" in it).

Relevant kanata config

debug.kbd

(defcfg
  ;; Process all unmapped keys normally
  process-unmapped-keys yes
  
  ;; Required for chordsv2
  concurrent-tap-hold yes
  
  ;; Rapid event delay for better compatibility
  rapid-event-delay 5
)

;; Define the source keys we want to intercept
(defsrc
  esc  f1   f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  caps a    s    d    f    g    h    j    k    l    ;    '    ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           spc            ralt rmet rctl
)

;; Aliases for cleaner configuration  
(defalias
  hyper (tap-hold 200 200 spc (multi lctl lalt lsft lmet))     ;; Tap: space, Hold: hyper key
  hyper_s (tap-hold 200 200 s (layer-while-held system))    ;; Hyper+S: system layer
)

;; Base layer - normal typing with layer activation keys  
(deflayer base
  esc  brdown   brup   _    _    _    _   MediaTrackPrevious   MediaPlayPause   MediaTrackNext   VolumeMute  VolumeDown  VolumeUp 
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  lctl a    @hyper_s  d    f    g    h    j    k    l    ;    '    ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           @hyper            ralt rmet rctl
)

;;  System Mode (hyper + s)
(deflayer system
  esc  brdown    brup   _    _    _    _   MediaTrackPrevious   MediaPlayPause   MediaTrackNext   VolumeMute  VolumeDown  VolumeUp 
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    brdown    brup   _    _    VolumeDown   VolumeUp   _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _              _              _    _    _
)

debug2.kbd

(defcfg
  ;; Process all unmapped keys normally
  process-unmapped-keys yes
  
  ;; Required for chordsv2
  concurrent-tap-hold yes
  
  ;; Rapid event delay for better compatibility
  rapid-event-delay 5
)

;; Define the source keys we want to intercept
(defsrc
  esc  f1   f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  caps a    s    d    f    g    h    j    k    l    ;    '    ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           spc            ralt rmet rctl
)

;; Aliases for cleaner configuration  
(defalias
  hyper (tap-hold 200 200 spc (multi lctl lalt lsft lmet))
  hyper_s (tap-hold 200 200 s (layer-while-held system))
  lyr_semi (tap-hold 200 200 ; (layer-while-held system2)) 
)

;; Base layer - normal typing with layer activation keys  
(deflayer base
  esc  brdown   brup   _    _    _    _   MediaTrackPrevious   MediaPlayPause   MediaTrackNext   VolumeMute  VolumeDown  VolumeUp 
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  lctl a    @hyper_s  d    f    g    h    j    k    l    @lyr_semi    '    ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           @hyper            ralt rmet rctl
)

;;  System Mode (hyper + s)
(deflayer system
  esc  brdown    brup   _    _    _    _   MediaTrackPrevious   MediaPlayPause   MediaTrackNext   VolumeMute  VolumeDown  VolumeUp 
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    brdown    brup   _    _    VolumeDown   VolumeUp   _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _              _              _    _    _
)

(deflayer system2
  esc  brdown    brup   _    _    _    _   MediaTrackPrevious   MediaPlayPause   MediaTrackNext   VolumeMute  VolumeDown  VolumeUp 
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _    brdown    brup   _    _    VolumeDown   VolumeUp   _    _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _
  _    _    _              _              _    _    _
)

To Reproduce

  1. sudo kanata_macos_cmd_allowed_arm64 --cfg ./debug.kbd
  2. hold space bar + s to enter system layer and press f
  3. nothing happens. Expected increase brightness

Follow same procedure with debug2.kbd and enter system2 with holding just ;
Then pressing f to increase brightness works.

Both system and system2 give a display_brightness_increment on press f in either config when monitoring input with karabiner event viewer

Expected behavior

If hyper is space key and "hyper + s" goes to system layer; and I have 'f' in system layer to increase brightness; and the signal seems to be sent as karabiner element viewer is picking it up; then the expected behavior is for brightness increase to work - as it does when using system2 layer with just ; pressed down to enter system2 which has f to increase brightness. This one too is picked up just like the other one by karabiner element viewer with:

  {
    "type": "down",
    "name": {"consumer_key_code":"display_brightness_increment"},
    "usagePage": "12 (0x000c)",
    "usage": "111 (0x006f)",
    "misc": ""
  },

Kanata version

kanata v1.9.0

Debug logs

No errors in debug log of either config. Startup logs:

08:26:07.8736 [INFO] kanata v1.9.0 starting
08:26:07.8741 [INFO] process unmapped keys: true
08:26:07.8744 [INFO] config file is valid
08:26:07.8744 [INFO] Sleeping for 2s. Please release all keys and don't press additional ones. Run kanata with --help to see how understand more and how to disable this sleep.
08:26:09.8797 [INFO] entering the processing loop
08:26:09.8800 [INFO] entering the event loop
08:26:09.8805 [INFO] Init: catching only releases and sending immediately
connected
driver_activated 1
driver_connected 0
driver_version_mismatched 0
08:26:10.5137 [INFO] Starting kanata proper
08:26:10.5139 [INFO] You may forcefully exit kanata by pressing lctl+spc+esc at any time. These keys refer to defsrc input, meaning BEFORE kanata remaps keys.
driver_connected 1

Operating system

Mac 15.5 (sequoia)

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmacosIssue pertains to macos; jtroo has no macOS devices and does not maintain the support for this OS.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions