diff --git a/modules/xorg/README.md b/modules/xorg/README.md index cdc97851..226282b2 100644 --- a/modules/xorg/README.md +++ b/modules/xorg/README.md @@ -9,7 +9,7 @@ The X display server as a module (novox/hq ADR 0208, research 026, to-be 42 phas - **Gated by the capability `seat`**, which the host reports for a machine with a graphics device and a connected display. See *Blockers* for why not `graphical-session`. - **Packages:** `xorg-server`, `xorg-xinit`, `xorg-xrandr`, `xorg-xset`, `xorg-xrdb`, `xorg-xinput`, - `xorg-setxkbmap`, `xorg-xwd` and `autorandr`. The GPU's driver is not here. It follows the machine, + `xorg-setxkbmap`, `xorg-xwd`, `xorg-xwininfo` and `autorandr`. The GPU's driver is not here. It follows the machine, so it belongs to that machine model's hardware module. ## What it owns @@ -71,7 +71,8 @@ which is a cpp directive error under plain `xrdb -merge` but is skipped here. | `xorg_input_devices` | r | the input devices, and each pointer's libinput settings | | `xorg_input_set` | a | tap, tap drag, natural scroll, disable while typing, left handed, middle emulation, enabled, acceleration, by device id or name | | `xorg_keyboard` | r/a | the XKB map; set layout, variant, model, options | -| `xorg_screenshot` | d | a PNG of the screen, one output or one window, inside the home (default `~/Pictures/Screenshots/`) | +| `xorg_screenshot` | d | a PNG of the screen, one output or one window, inside the home (default `~/Pictures/Screenshots/`); with `inline`, the PNG in the answer as base64 (at most 4 MiB) | +| `xorg_windows` | r | the windows as the X server knows them, managed or not: id, name, instance and class, size and place; with a class or name filter (or `detail`), each one's depth (`argb`), visual, map state, override-redirect, types, states, role and own opacity | | `xorg_x_log` | r | the X server's log for the running session: version, start, errors (and warnings) | All answers are structured. Each tool that changes the running server says how long the change lasts. @@ -90,7 +91,19 @@ The bus it hands on is the user manager's (`unix:path=/run/user//bus`). Wit answers `{"error": "no-graphical-session", "reason": …, "looked": […]}`. The screenshot needs no screenshot program. `xwd` dumps the screen, and the module turns the dump -into a PNG itself. +into a PNG itself. **A window is cut from the dump of the whole screen** at the place `xwininfo` gives, +never dumped by its id: `xwd -id` asks the server for the window's colormap entries, which a window of +a 32-bit (alpha) visual refused with `BadColor (X_QueryColors)` on a workstation (2026-10-09), and the +cut shows the window as the compositor shows it, which is what a question about a window that looks +wrong needs. A window under another one shows what covers it. `inline` answers the image itself, for a +session that cannot read the machine's files. + +`xorg_windows` exists because a window manager lists only the windows it manages, and says nothing a +compositor goes by. A window of depth 32 has an alpha channel: the compositor blends it with what is +behind it, so one whose program drew nothing looks transparent rather than black. Its details take +two commands per window (`xwininfo -all`, and `xprop` for the role and the window's own opacity), so +they are read for at most 40 windows. `xprop` is the `picom` module's package; without it the role and +opacity are left out. ## What it improves diff --git a/modules/xorg/cmd/xorg/main.go b/modules/xorg/cmd/xorg/main.go index fd28adf4..56e95f5b 100644 --- a/modules/xorg/cmd/xorg/main.go +++ b/modules/xorg/cmd/xorg/main.go @@ -143,16 +143,34 @@ func tools(d desktop.Desk) []stdio.Tool { }, { Name: "xorg_screenshot", - Description: "Take a screenshot to a PNG file: the whole screen, one output, or one window by its X id. " + + Description: "Take a screenshot to a PNG file: the whole screen, one output, or one window by its X id " + + "(cut from the screen as the compositor shows it, so a see-through window shows what is behind it). " + "Written under the account's home (default ~/Pictures/Screenshots/screenshot-