I’ve started running all my Claude Code and Copilot sessions inside [herdr](https://herdr.dev), a terminal multiplexer that knows about coding agents. It has a sidebar that lists every agent and whether it’s working or waiting for me, and I keep it hidden until I need it. To toggle it you press `ctrl+b`, then `b`. That’s two chords for something I do a hundred times a day, and I wanted to just tap Left twice.

Herdr can’t do that ([herdr#3059](https://github.com/herdrdev/herdr/discussions/3059)). Left arrives as `ESC [ D`, with no key-up event and no timing, so there is nothing to tell a deliberate double-tap from someone holding the key down. Herdr lets you bind Left, but then Left belongs to herdr in every pane, and Claude Code can no longer move the cursor.

### Karabiner-Elements

[Karabiner-Elements](https://karabiner-elements.pqrs.org/) remaps keys on macOS at the keyboard driver level, before any app sees them. It knows about timing, it can keep state in variables, and it can limit a rule to the app in front. That’s everything the terminal doesn’t have.

```
brew install --cask karabiner-elements
```

The gist of the rule is two manipulators. The first Left sets a variable and goes through to the terminal as usual. A delayed action clears the variable after 300 ms. If a second Left arrives while the variable is still set, Karabiner sends `ctrl+b` `b` instead. Both are scoped to Terminal, so Left in every other app is untouched.

```
{
  "description": "Terminal: double-tap Left sends ctrl+b, b (toggle the herdr sidebar)",
  "manipulators": [
    {
      "type": "basic",
      "from": { "key_code": "left_arrow" },
      "to": [
        { "key_code": "b", "modifiers": ["left_control"] },
        { "key_code": "b" },
        { "set_variable": { "name": "herdr_left_tap", "value": 0 } }
      ],
      "conditions": [
        { "type": "frontmost_application_if", "bundle_identifiers": ["^com\\.apple\\.Terminal$"] },
        { "type": "variable_if", "name": "herdr_left_tap", "value": 1 }
      ]
    },
    {
      "type": "basic",
      "from": { "key_code": "left_arrow" },
      "to": [
        { "set_variable": { "name": "herdr_left_tap", "value": 1 } },
        { "key_code": "left_arrow" }
      ],
      "to_delayed_action": {
        "to_if_invoked": [{ "set_variable": { "name": "herdr_left_tap", "value": 0 } }],
        "to_if_canceled": [{ "set_variable": { "name": "herdr_left_tap", "value": 0 } }]
      },
      "parameters": { "basic.to_delayed_action_delay_milliseconds": 300 },
      "conditions": [
        { "type": "frontmost_application_if", "bundle_identifiers": ["^com\\.apple\\.Terminal$"] }
      ]
    }
  ]
}
```

Karabiner uses the first manipulator whose conditions match, so the second-press one goes first. Any other key cancels the delayed action, so Left, `a`, Left doesn’t count. I added the same rule for Right with its own variable, so Left then Right doesn’t count either.

Karabiner ships with a linter that takes a single rule, which is handy when an agent writes the JSON for you.

```
/Applications/Karabiner-Elements.app/Contents/Helpers/karabiner_cli --lint-complex-modifications rule.json
```

Here’s what it looks like. Left, Left opens the sidebar, Left, Left closes it.

![A Terminal window running herdr. Pressing Left twice opens the sidebar listing spaces and agents, and pressing Left twice again hides it.](/images/posts/2026/2026-12-01-working-around-terminal-limitations-with-karabiner/herdr-double-left.gif)

Note that the first left still reaches the pane, because Karabiner can’t know a second one is coming. Claude Code, however, switches to its session list when you press Left on an empty prompt, which is exactly what happens in the recording above.

### Dotfiles

The config is in [my dotfiles](https://github.com/dblock/dotfiles/tree/master/karabiner). Link the whole directory, not the file, because Karabiner replaces `karabiner.json` when it saves, which breaks a symlinked file.

```
ln -sfn ~/source/dotfiles/karabiner ~/.config/karabiner
```
