@rifuki/negi
v0.2.38
Published
tmux and your Mac's screen, on your phone, over your tailnet.
Maintainers
Readme
Your agent stops to ask a question while you are away from the desk. Open negi on your phone, read the pane, answer it, and it carries on. One Rust binary on your Mac serves the page over your tailnet; nothing goes through anyone else's server.
What it does
- Every tmux session, window and pane on your phone, live, with the colours your programs print.
- Type into a pane, with a key row for esc, tab, ctrl, option, command and the arrows.
- Answer an agent's prompt, scroll back through a pane, send a file into it.
- See and drive the Mac's own screen as live video, with touch as a trackpad.
- The Mac's battery and Wi-Fi at a glance, and a speed test of the link to it. While a phone is connected the Mac does not sleep for idleness (closing the lid still sleeps it).
Install
brew install rifuki/tap/negior npm install -g @rifuki/negi, or cargo install negi. Without Homebrew, curl -fsSL https://raw.githubusercontent.com/rifuki/negi/main/scripts/install.sh | sh copies the release binary to ~/.local/bin, and negi update later installs each new release over it and restarts the negi service (a Homebrew, npm or cargo install says to update through those instead). macOS 12.3 or later on Apple silicon, or Linux x86_64 (the screen as live video needs a Wayland compositor with screen capture and VA-API, see below); elsewhere, cargo install negi builds it.
Get started
With Tailscale signed in on the Mac and on the phone:
negi serve # keep it running; brew services start negi does it at login
negi tailnet # serves it on your tailnet and prints its https address
negi pair # scan its QR with the phone's camera, or open the address and type the codeThe QR opens the pair page with the code filled in, and the page still waits for Pair, since a QR could come from anyone's terminal. A scan from the camera opens the browser, which keeps its own sign-in apart from a Home Screen app; in the installed app, Scan the QR on its pair page.
On the phone, Share, Add to Home Screen (or Install app on Android) opens negi full screen like an app, and it still opens when the Mac is out of reach.
On a phone the screen works as a trackpad. With a mouse, a click on it hands the mouse to the Mac, buttons and wheel included, and Esc takes it back.
The screen comes as live video from negi itself. macOS asks once for Screen Recording
(to see it) and Accessibility (to drive it), for negi or the terminal it runs in. Without
them negi falls back to Screen Sharing (System Settings, General, Sharing), which asks for
your Mac login. If the page still asks for Accessibility while negi is switched on in that
list, the grant belongs to an older negi: remove it with − and add ~/.local/bin/negi again.
The page notices within two seconds, without a reconnect. The screen page and the Mac's sheet
both open a guide, Set up the screen, that shows each permission's state as it changes and
opens the right page of System Settings on the Mac from the phone.
On Linux the screen comes as live video too, on a Wayland compositor that offers
ext-image-copy-capture-v1, virtual pointer and keyboard (Hyprland does) and a GPU with a
VA-API H.264 encoder (Intel's intel-media-driver, for one). negi opens VA-API, GBM and PAM
only when it needs them, so without them it runs as before and the screen falls back to VNC.
Each phone gives the Linux account's password once, checked by PAM.
Safe by default
- Other devices reach it only through your tailnet, and only signed in as you.
- Each phone pairs once with a one-time code that
negi pairtakes back on Ctrl+C;negi revokeunpairs it. - Keys are stored hashed; a kept screen login is sealed by the server for one device.
- Before live video shows the screen or takes input, each phone gives the Mac's password once. macOS checks it; negi does not keep it, and five wrong tries lock that phone out for five minutes.
License
MIT for the code.
Hatsune Miku is a character of Crypton Future Media, INC., used here non-commercially under the Piapro Character License. © Crypton Future Media, INC. www.piapro.net. The drawings of her were made for negi and are not covered by the MIT licence.
