hijackey

command module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 9 Imported by: 0

README

hijackey

Hijack keystrokes for CLIs that won't let you rebind them.

hijackey space=d b=u leaf README.md
hijackey q=esc some-cli

While leaf runs, space is d and b is u.

Install

Unix only (macOS/Linux), via creack/pty.

brew install oooooooo/tap/hijackey

Or, with a Go toolchain:

go install github.com/oooooooo/hijackey@latest

Or, build from source:

git clone https://github.com/oooooooo/hijackey.git
cd hijackey
# https://taskfile.dev/docs/installation
task build

Usage

hijackey [srcKey=dstKey ...] <command> [args...]

A key is a single ASCII character (d, U, ...) or a named key: space, tab, enter, backspace, esc, eq (=).

hijackey --version (or -v) prints the version and exits; --help (or -h) prints this usage and exits.

Alias

alias leaf='hijackey space=d b=u leaf'
leaf --width 80 README.md

Limitations

No multi-byte sequences (arrow keys, function keys, mouse reports) — only single raw bytes. Remapping esc can break arrow keys, which also start with ESC.

License

MIT

Documentation

Overview

Command hijackey runs another program under a pseudo-terminal and remaps single-byte keystrokes before they reach it, e.g.:

hijackey space=d b=u leaf

presses 'd' as if space were pressed, and 'b' as if 'u' were pressed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL