From 32d3ec7ea8bda6afc8614a100dfdc7421ecf76be Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 3 Nov 2026 12:57:24 -0300 Subject: fs: kbdin and mousein at the root, rio's and devmouse's (windows/rio/xfid.c:515, kernel/devices/mouse/devmouse.c:445): each rune written to kbdin is a key typed at the pane with the keyboard (control runes Ctrl and a letter but Plan 9's keys: \n Enter, \t Tab, \b Backspace, 0x7f Delete, 0x1b Esc, keyboard.h's private-use runes for the arrows, Home, End, Page Up and Down, Insert, F1-F12), a mousein line `m col row buttons` the mouse as it now is in cells (1 left, 2 middle, 4 right, 8 and 16 a wheel notch), what changed released, moved or pressed; each done before the write is answered, so a script's next read sees it with no sleep; the held buttons are core state, which a replica replays; test/fs.py's keys_and_mouse types, finds the word on /screen and right-clicks it, the first e2e case written through the files alone Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- docs/typ/reference.typ | 17 +++++++++++++++++ docs/typ/scripting.typ | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index e60964cc..75b33151 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -28,6 +28,8 @@ screen the rendered screen as JSON @on listeners dial addresses @other-files sessions the pardes daemon's sessions and shells (pardes --ps) @other-files focus the serial of the pane with the keyboard; write one to move it @columns-and-tags +kbdin write runes: keys typed at the pane with the keyboard @other-files +mousein write m col row buttons: the mouse as it now is @other-files ctl settings and session builtins @root-ctl commands every builtin, one a line @other-files recent files opened lately: open|closed @other-files @@ -906,6 +908,21 @@ at 200, ending in `…`. Control characters become spaces. = Other files +- #file("/kbdin") (write only), rio's: each rune written is a key typed at + the pane with the keyboard, done before the write is answered, so a + script that writes keys then reads a file sees what they did. Control + runes are Ctrl and a letter, but for Plan 9's keys + (`keyboard.h`): `\n` or `\r` #key("Enter"), `\t` #key("Tab"), `\b` + Backspace, `0x7f` Delete, `0x1b` #key("Esc"), and the + arrows, Home, End, Page Up and Down, Insert and F1-F12 at their + private-use runes (`U+F00E` up, `U+F800` down, `U+F011` left, `U+F012` + right, `U+F00D` Home, `U+F018` End). No Alt, Shift or Super. +- #file("/mousein") (write only), devmouse's, in cells: a line `m col row + buttons` is the mouse as it now is, the buttons Plan 9's bits (1 left, 2 + middle, 4 right; 8 and 16 a wheel notch up and down). What changed since + the last line is released, moved or pressed there, in that order: `m 10 + 5 4` then `m 10 5 0` is a right click (a #word("Look")) at column 10, + row 5. Cells are #file("/screen")'s. - #file("/screen"): JSON `cols`, `rows`, `cursor`, `styles`, and row-major `cells` of `[grapheme, style_index]`; one frame per open. Compare a cell's style through `styles`, not the index. diff --git a/docs/typ/scripting.typ b/docs/typ/scripting.typ index d90f68ac..1116063d 100644 --- a/docs/typ/scripting.typ +++ b/docs/typ/scripting.typ @@ -9,8 +9,9 @@ files is an extension: ``` $ ls $m -README col commands ctl exec focus index layout listeners log -look os pager pane recent screen sessions status tag tagexec +README col commands ctl exec focus index kbdin layout listeners +log look mousein os pager pane recent screen sessions status tag +tagexec $ cat $m/index 1 term 0 /home/me/src 1 2 text 0 /home/me/src/+New 1 -- cgit v1.3