Condition the configuration on a pane's foreground program #32
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wayfinder:map
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jeff/harrier#32
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Let the configuration depend on a pane's foreground program, the leader of its pty's foreground process group, through
ctx.foreground. Examples: a red background while it runs as root, and other colors and bindings forsshorpwsh. The design is in ADR 0006, and the term is inGLOSSARY.md.What to build
Config.Context.foreground: ?Foreground, holdingname(basename ofargv[0]),exe: ?[]const u8(/proc/<pid>/exe, null if it can't be read),uid: u32(effective) anduser: ?[]const u8(passwd entry, null if there is none). It is null app-wide, on Windows, and for non-Pty panes.foreground = nulldecides everything that isn't per pane. Each Pty pane evaluates again with its foreground program and takes onlycolors, the non-globalkeybindentries,bell,cursor,clipboard,link_detection,notifications,drag_and_dropandimages; its profile overrides go on top.grapheme_widthstays fixed for the life of the pane.validate-configreports it.ctx.foregroundvalue: 64 entries, LRU, cleared on reload or an appearance change. A failed evaluation is logged once per program per reload, and the pane keeps the app-wide values.tcgetpgrpbefore each key is dispatched and after each output batch, and on a timer everyforeground_poll_ms(new top-level setting, default 250, 0 = key/output only). The timer also re-reads the leader's start time and UID, pluscmdlinewhen either changes, to catchexecorsetuid. If the leader has exited but the group remains, keep the last seen value.ctx.foreground, skip the per-pane evaluation and polling. Blocked on struthio reporting whichctxfields a program read (requested from the struthio session).validate-config --foreground NAME[:UID], repeatable. Without it, check: no foreground program, the user's own uid, and uid 0.use_ptymeanssudo -iandsudo sshboth look likesudowith uid 0; tmux, screen and the far side of ssh are invisible.Out of scope
Showing the foreground program anywhere else (subtitle, status window, shell search). Windows support.
struthio can now report which
ctxfields an evaluation read, in struthio commitbcdafb8on main. It hasn't been pushed yet, so it can't be fetched. harrier currently pinse1167b6, 12 commits behind, so expect API drift when bumping.and/or, and thelets and@includes that were used. Barectx(let c = ctx;) counts as reading every field.ctxfields stay the same, so after an appearance change, re-check using the new evaluation's set.Call.ctxis now the methodcall.ctx().@envand@settingdon't touch ctx, so they're unaffected.