Repository navigation
Add cross-terminal attention handling for program status - #756
Conversation
|
Looks good. I can see you fixed some details: input acknowledges in seen mode, killing terminal clears it records, etc. I named the option I liked the indicator in my version better. Two issues:
From #753 (comment)
I agree. It requires using it a bit to understand the issues and polish the implementaion. I found the 6 icons important because it primes you to what the "blocker" is. When I then switch to the buffer via The new "AI terminals" (herdr, orca, tuios, etc) fixes this by always showing the running agents in a window. I will probably have to experiment with showing status-list in a dedicated window (and make some support for narrow windows). I will also try out your consult support |
937203f to
751c388
Compare
|
I tested consult-ghostel-status In consult-ghostel-marginalia-annotate If I replace with the status color for done/busy/error/etc is preserved ( it appends the property) |
|
@vjohansen thanks for the feedback. I have tested many versions over the last few days and I'm still not 100% sure. To your valuable feedback:
Agreed, renamed.
I think you already saw how I changed it. You can now customize kind as well, and with the emojis it's even default
Also agree, but the problem is that I do not want people reporting bugs because there font can't display the emojis (or displays them in an ugly fallback font).
Fixed, thanks. Do you want to have another check if what's now in this branch is already good enough for you (and you can build your status-list on top of this)? |
0ed8fdd to
61b2a95
Compare
|
I have been rebasing (several times) my status-list commit etc on your feat/status-attention branch the last two days. It has been working without issue. I can see you just pushed 4 commits. I will do further testing of this new code. I can certainly understand your emoji argument. Just last month I had to debug why emojis where not showing correctly on one my windows machines. I had to fiddle with |
Terminals holding a record in ghostel-status-notify-states count as needing attention, ranked blocked > error > done. ghostel-status-next cycles through them, and ghostel-status-buffers and ghostel-status-buffer-state expose the ranking to other packages, with an optional list of states. Buffer pickers show the terminal's status in their annotation and consult-ghostel gains a "Needs attention" source and command. ghostel-status-indicator-mode counts terminals per state in global-mode-string, the states in ghostel-status-indicator-states, by default the attention states plus working, so the mode line also shows which terminals still run. A terminal stands by its root record when that holds the state, else by the newest record that does, so a child's percentage does not replace the terminal's own label. ghostel-status-acknowledge-on-input becomes ghostel-status-auto-acknowledge with the values input, seen and nil; seen drops done and error records as soon as the terminal is the buffer being looked at. A tty frame without focus reporting now counts as focused for that check and for notification suppression. Killing a terminal drops its records so nothing counts it afterwards. ghostel-status-mode-line-format frames every status label, a format-spec string with the label and three count specs, and ghostel-status-mode-line-labels takes the blocked kinds as keys so an icon can stand for each; the indicator counts terminals per distinct label. The default working label reads working instead of ..., which only made sense next to the spinner. Addresses #753.
A program speaking OSC 7501 often also sends a desktop notification for the same event, so the permission prompt of Claude Code notified twice. While a terminal's program reports its status, OSC 9 and OSC 777 no longer run `ghostel-notification-functions'; the status changes run it through `ghostel-status-notify' instead. A root `clear', a new prompt, the process exit or RIS end the gate, which also re-arms OSC 9;4 progress at those points. The gate resets in ghostel-status--clear for the root, so the OSC clear handler, buffer kill and terminal restart share it. Without shell integration a program exiting without clear leaves it on until the shell exits. `ghostel-status-attention-p' is the condition `ghostel-status-notify' applies, public for members of `ghostel-program-status-functions' that notify with more than title and text.
The terminal's mode line listed the blocked and error records, newest first, or else the root. It now shows one label per distinct label among all records, most urgent first, counted when several read the same, so it agrees with the global indicator and the picker annotation, which build their text through the same grouping helper. The spinner runs only while the root is the sole record. ghostel-status-mode-line-labels is now `emoji', `words', or an alist of format-spec strings that carry their own frame and count spec (%p, %k, %n, %c, %x). The emoji preset falls back to the word labels when the selected frame cannot display them. The separate ghostel-status-mode-line-format option is gone; each label carries its own leading space. ghostel-status-buffers ranks each buffer once, the input acknowledge wrapper is inlined at its only call, and the README rows for the indicator, notify states and notification hook describe what they do.
61b2a95 to
8b3c008
Compare
Addresses #753.
A terminal counts as needing attention while it holds a record in a state of
ghostel-status-notify-states(default blocked, done, error), ranked blocked > error > done.ghostel-status-buffer-statereturns a terminal's most urgent such state andghostel-status-bufferslists the attention terminals most urgent first; both are public so a list buffer like the one in the issue can be built outside the repo.On top of that:
ghostel-status-nextswitches to the most urgent attention terminal and walks the rest on repeat, with a "Next Needing Attention" menu entry.ghostel-status-indicator-mode(global, opt-in) counts the attention terminals per state inglobal-mode-string, e.g.[blocked: permission ×2] [done], names them on hover, and a click runsghostel-status-next. The mode requires ghostel when enabled so it can be turned on from init before any terminal exists.ghostel-annotate-buffershows the terminal's status label before its title, so every picker (read-buffer, consult, marginalia) shows it.consult-ghostel-statusand a hidden "Needs attention" source thatconsult-ghostel-moderegisters inconsult-bufferunder theanarrow key, following the pattern of the hidden Ghostel source so terminals do not appear twice.Acknowledging:
ghostel-status-acknowledge-on-input(t/nil) is replaced byghostel-status-auto-acknowledgewith the valuesinput(default, as before),seenand nil, without an alias.seendrops done and error records as soon as the terminal is the buffer being looked at, either when such a record arrives or when the buffer becomes looked at.M-x ghostel-status-acknowledgedrops them by hand. "Looked at" isghostel--buffer-focused-p, the same predicate that already suppresses notifications; it now also treats a frame whose focus Emacs cannot tell (a tty without focus reporting) as focused, soseenand notification suppression work there. Killing a terminal drops its records so nothing counts it afterwards.Labels:
ghostel-status-mode-line-labelsalso takes the blocked kindspermission,questionandauthas keys; a kind entry replaces the state label and the appended kind text, so an icon can stand for each case.ghostel-status-mode-line-format(default" [%l%x]") frames every label, aformat-specstring with%llabel,%ncount,%ccount only when several and%x×Nonly when several;" %l%n"with icons gives🔒2 ✅1. The indicator counts terminals per distinct label, so different kinds get their own label and kinds sharing an icon merge.All of the status code stays in
lisp/ghostel-status.el;ghostel.elonly gained the input, focus-change, kill-buffer and annotation call sites.Tests: elisp tests for the ranking, the cycling order, the indicator text, the annotation, all three acknowledge modes, the kill-buffer cleanup and the unknown-focus predicate, plus the consult source items. Verified live under elate on a tty Emacs 32 where
frame-focus-stateisunknown: indicator text and hover, cycling, acknowledge modes, annotation, and enabling the indicator mode from init with only the autoloads loaded.