Run on macOS: bash 3.2, arrow keys, and honest session reporting

macOS ships bash 3.2, and the port used three things it does not have:
mapfile, fractional `read -t`, and GNU `stat -c`. The first two took the
interactive menu down - `mapfile: command not found` in the preset
picker, and an arrow key that parsed as a bare Escape, leaving `[C` in
the tty for zsh to report as a bad pattern.

read_key now reads the escape tail through the terminal itself: icanon
off with min 0 / time 1, so a plain read returns the moment a byte
arrives and gives up after ~0.1s. bash 3.2's `read -t 0` cannot be used
to poll for this - it reports nothing even with bytes buffered (checked
against 3.2.57). CSI sequences are consumed whole, so modified keys like
Ctrl+Right no longer leak their tail either. Verified interactively
under bash 3.2.57 in a pty: arrows, pgup/pgdn, home/end, enter,
backspace, and a bare Escape all parse, with no stray bytes in the tty.

Session listing reads /proc, which macOS does not have; it now says so
rather than silently reporting no running sessions - the answer that
gets people to switch out from under a live session. install.sh swaps
GNU `find -print -quit` for a glob, and the README notes both.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
smoido
2026-09-12 21:58:58 +03:00
co-authored by Claude Code
parent 69c7810345
commit 5a1af9f7e6
3 changed files with 107 additions and 15 deletions
+9
View File
@@ -82,6 +82,15 @@ Secrets have no DPAPI equivalent here, so the vault picks the best backend
available and says which one it chose: macOS Keychain, libsecret, `pass`, or a
0600 file that is honestly labelled as unencrypted.
It runs on the **bash 3.2 that macOS ships** — no Homebrew bash needed. The
menu reads arrow keys through the terminal's own timing (`min 0 time 1`) rather
than a fractional `read` timeout, which 3.2 rejects, and the port avoids
`mapfile` and GNU-only `stat`/`find` flags for the same reason.
Session listing reads `/proc`, so it is **Linux-only**. On macOS a switch says
it cannot check for running sessions instead of claiming there are none — so
restart Claude Code yourself after switching.
### Omarchy bar widget
```bash