Holding Esc quits wherever MeshTerm can tell the key is held

Hold-to-quit was the Cardputer's alone. It is now MeshTerm's gesture
everywhere a key can be seen coming up, which a terminal never reports:

- The emulator's window, for either handheld, which reads its own keys
  as the Cardputer's panel does.
- A terminal's Esc, where the keyboard can be asked whether it is still
  down: GetAsyncKeyState on Windows, as the right-Ctrl rescue already
  asks, and EVIOCGKEY on Linux wherever the keyboard's event device
  opens (the PicoCalc, a uConsole, a user in `input`). It reads the key
  state only, no events.

An Esc arriving while its key is still down is held back as a hold:
delivered as it comes up, a box after a second, gone at three. The
keyboard's repeats are part of the hold, a key typed during it goes in
behind the Esc, and on a VT stream the last repeat, which prompt_toolkit
can parse after the key is up, is dropped rather than going back a
screen behind a box the reader just let go of. On macOS and over SSH Esc
is unchanged.

SIGTERM is a quit for the interactive menu on every platform now, not
only under the Cardputer's launcher: a system shutting down gets the
same clean exit, terminal and console font restored.

EVIOCGKEY checked on the Cardputer's arm64 kernel; the Lyra was offline.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5.5 committed 2026-10-06 01:20:53 -04:00
1 parent 9d16e0722a
commit b9585e9b59
12 files changed
+529 -91

No files matched your search

+3 -2
View File
@@ -533,8 +533,9 @@ radio behind it, drawing braille charts and node glyphs cleanly — no empty tof
the bottom you should see the **F-key lane**: five labelled chips instead of the footer hint
line a desktop terminal shows.
Have a look around. **Esc** backs out of any screen, and **Quit** on the main menu leaves
the app.
Have a look around. **Esc** backs out of any screen. To leave the app, choose **Quit** on
the main menu, or hold **Esc** for three seconds from any screen. After a second a box
shows a bar filling up, and letting go before it fills keeps you where you were.
Then look at the whole visual language on one card:
+22
View File
@@ -71,3 +71,25 @@ pages close it.
| **👤 About the author** | The person behind MeshTerm, on the mesh and off it. | `meshterm about-author` |
| **🔗 Join Discord** | The community server: one invite link, and a QR of it for a phone to read. | `meshterm discord` |
| **💰 Support MeshTerm** | What keeps MeshTerm going, and the ways — paid and unpaid — to help it along. | `meshterm support` |
## Leaving MeshTerm
**Quit** at the bottom of the main menu leaves, after asking. **Ctrl+Q** asks the same
question from any screen, and pressing it again while the question is up leaves at once.
You can also hold **Esc**. After a second, a box says *Hold Esc to quit*, with a bar that
fills over the next two seconds. When it's full, MeshTerm closes, the same way Quit closes
it. Let go before then and you're back where you were. While the box is up, MeshTerm
doesn't start sending anything new over the radio, so a message that's going out finishes
first. A quick press of **Esc** still goes back a screen, as always.
Holding Esc only works where MeshTerm can tell that a key is being held down, and a
terminal never says when a key comes back up. These can tell:
- Windows.
- Linux, where you can read your keyboard's input device. That includes the PicoCalc, and
a uConsole or any other Linux computer where your user is in the `input` group.
- The Cardputer Zero, and the [emulator](../devices/cardputer-zero.md#trying-it-in-the-emulator)
window for either handheld.
On a Mac, or over SSH, Esc works as it always did.