Skip to content

Add ghostel-set-program-status for bridged terminals - #810

Merged
dakra merged 1 commit into
mainfrom
feat/set-program-status
Nov 12, 2026
Merged

dakra merged 1 commit into
mainfrom
feat/set-program-status

Conversation

@dakra

@dakra dakra commented Nov 12, 2026

Copy link
Copy Markdown
Owner

A bridged terminal fed from a libghostty snapshot plus the raw PTY stream gets no program status records (OSC 7501) from the snapshot. When the far end keeps them, the client needs a public way to put them into the buffer without notifying for day-old catch-up state.

API

(ghostel-set-program-status RECORDS &optional QUIET), called in the terminal buffer.

  • RECORDS is the complete new set: a list of (ID . PLIST), most recently updated first, ID a string ("" for the root), PLIST with :state, :kind (symbols), :progress, :app, :title, :msg.
  • Unknown state counts as idle; unknown kind and progress outside 0-100 are dropped. ghostel--osc-program-status builds its records through the same check (ghostel-status--valid-record).
  • Records not in RECORDS are removed by ID, so a removed parent does not take a kept child with it. ghostel-program-status-functions runs once per record added, changed or removed, after the whole set is in place; equal records run nothing.
  • QUIET binds the new ghostel-status-inhibit-notify, which makes ghostel-status-attention-p nil, so ghostel-status-notify and notifiers built on it stay silent. ghostel-status-notify-states keeps its value, so ghostel-status-buffers, the mode line and the indicator report the states normally, also inside the hooks.
  • A non-empty set suppresses OSC 9/777 and OSC 9;4 like a real OSC 7501 report; an empty one re-enables them. The root record's title follows. Under ghostel-status-auto-acknowledge seen, done/error records set into the buffer being looked at are acknowledged at once.

Tests

New elisp tests in test/ghostel-status-test.el: full replace (added, changed, unchanged with no hook, removed), parent removed while child kept, validation, QUIET vs. non-QUIET notification with ghostel-status-buffers checked inside the hook, OSC 9 / 9;4 suppression, root title, and seen acknowledgement. make -j8 all passes.

A bridged terminal whose far end keeps the program status records
(OSC 7501) needs to put them into the buffer after restoring a
snapshot, which carries none.  ghostel-set-program-status replaces
the records as a whole: ghostel-program-status-functions runs only
for records added, changed or removed, and a removed parent no longer
takes a kept child with it.  Unknown states count as idle; unknown
kinds and progress outside 0-100 are dropped, through the same check
the OSC path uses.

With QUIET none of the changes notifies.  The new
ghostel-status-inhibit-notify makes ghostel-status-attention-p nil
while it is bound, so ghostel-status-notify and notifiers built on it
stay silent while ghostel-status-notify-states keeps its value for
ghostel-status-buffers and friends.

A non-empty set suppresses OSC 9/777 and OSC 9;4 as a real report
does, an empty one re-enables them, and done/error records are
acknowledged at once under ghostel-status-auto-acknowledge seen.
@dakra
dakra merged commit f42d478 into main Nov 12, 2026
33 checks passed
@dakra
dakra deleted the feat/set-program-status branch November 12, 2026 15:42

This branch was previously deployed

1 inactive deployment
github-pages — f42d478c Deployed Nov 12, 2026 by dakra via deploy #267
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant