diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bc1606d..d253f003 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Programa is a fork of [cmux](https://github.com/manaflow-ai/cmux); for history p - On Windows, pasting text with line breaks or control characters into a program that has not turned on bracketed paste (cmd.exe, PowerShell) asks first, with a preview. ### Changed +- A focused terminal that has nothing new to show uses about half as much CPU. It stops waking up on every screen refresh after a quarter second of quiet and starts again on the next change. - Only one copy of Programa runs at a time: launching a second copy brings the running app forward and exits. - Closing a window with its red button or Close Window asks first when any of its workspaces has a running process, with the same confirmation as closing the last workspace. The socket method `window.close` still closes without asking. - Splitting a pane or opening a pane from the socket or CLI no longer moves focus; only explicit focus commands do. diff --git a/docs/ghostty-fork.md b/docs/ghostty-fork.md index 5dcce76d..c6e6340a 100644 --- a/docs/ghostty-fork.md +++ b/docs/ghostty-fork.md @@ -13,14 +13,15 @@ When we change the fork, update this document and the parent submodule SHA. ## Current fork changes -The pinned fork head is `9d8aeccac` on the fork branch `osc7501-program-status`, which is -fork `main`'s `bccfc8333fecf707dd918d46e3849fc8ed72cca0` plus the OSC 7501 patch group. Never -delete that branch: the pin and its xcframework release point at it. It is built on +The pinned fork head is `617aac442` on the fork branch `idle-park-display-link`, which is +fork `main`'s `bccfc8333fecf707dd918d46e3849fc8ed72cca0` plus the OSC 7501 patch group and the +idle display link park. Never delete that branch: the pin and its xcframework release point at it. It is built on `ghostty-org/ghostty` `main` at `c8634f3fce12f8189ed058e018195eb693f8562b` and Zig 0.16.0, and -carries the eleven patch groups below: display-link restart, resize stale-frame mitigation, OSC 99 +carries the twelve patch groups below: display-link restart, resize stale-frame mitigation, OSC 99 notifications, theme picker hooks, color scheme mode 2031, keyboard copy mode selection API, layer-background flag, occluded-surface throttle, offscreen renderer realization, session -introspection and revival APIs (which include the PTY tee), and OSC 7501 program status. +introspection and revival APIs (which include the PTY tee), OSC 7501 program status, and idle +display link parking. Prebuilt framework for the pinned head: @@ -189,6 +190,28 @@ tend to conflict together during rebases. - `GHOSTTY_OSC_COMMAND_PROGRAM_STATUS` is 26 here and 28 upstream, because the pin lacks the Kitty desktop notification and unknown-OSC commands. Take upstream's value on the next sync. +### 12) Idle display link parking + +- Commits: `2076a6134` (renderer: park an idle display link until the next change), + `617aac442` (reset the idle timer under `draw_mutex`) +- Files: + - `src/renderer/generic.zig`, `src/renderer/Thread.zig` +- Summary: + - A focused, visible terminal ran its CVDisplayLink nonstop. Every vsync woke the render thread + for a `drawFrame` that found nothing to draw, about 1.2% of a core per focused terminal on an + Apple Silicon Mac. + - `drawFrame` notes each tick with nothing to draw and stops the link after 250ms of them. + `Thread.drawFrame` calls `resumeVsync` instead of `hasVsync`, which restarts a parked link when + the surface is visible and focused, so the change still draws on the next vsync rather than + without one. + - Restarting a parked link added about 4ms to that one draw on a bench. 250ms outlasts the gap + between keystrokes, so typing keeps the link running, and stays under the 600ms cursor blink, + so a blinking prompt still parks between blinks. +- Conflict notes: + - Upstream reworks `syncDisplayLink` and the vsync path in `Thread.drawFrame` from time to time. + Keep the `resumeVsync` call at the `!now` draw gate and the idle-timer reset wherever the link + starts. + ## Upstreamed fork changes ### cursor-click-to-move respects OSC 133 click-to-move diff --git a/ghostty b/ghostty index 9d8aecca..617aac44 160000 --- a/ghostty +++ b/ghostty @@ -1 +1 @@ -Subproject commit 9d8aeccac8a76906864c684b340af09f29d13487 +Subproject commit 617aac44206e6a88761e4b3a253547e07b8870df diff --git a/scripts/ghosttykit-checksums.txt b/scripts/ghosttykit-checksums.txt index 3cba08af..0d829c18 100644 --- a/scripts/ghosttykit-checksums.txt +++ b/scripts/ghosttykit-checksums.txt @@ -23,3 +23,4 @@ c25020f993597285a331a76dcd7c8a6345b7e360 7ada2bddb5a33026fa5ff255a3f5fb4cabd44a6 96316fc506f0015f6e8e3906b995e2c4aba23ebf 0f12f0d6dd920ccfa49789eae1018be314344797894ef0aae7db3e90fc27a441 bccfc8333fecf707dd918d46e3849fc8ed72cca0 26441b6e038523b9c6223bfbb73535a727d5c7c26c225326dc85122bda30881f 9d8aeccac8a76906864c684b340af09f29d13487 66ddf8bc25e53aef8d48cf75491a28882f57d0621ad6efae7060768e677c21d1 +617aac44206e6a88761e4b3a253547e07b8870df a2be0acaeaa4740c6f8d27adbc7529d1a7318dd224250f25edfa773b28b1949f