client: run a keymap command in the background without a transient session #224
Labels
No labels
Area/ci
Area/cli
Area/client
Area/client-core
Area/daemon
Area/deps
Area/docs
Area/grid
Area/manual
Area/nix
Area/protocol
Area/pty
Area/render
Area/shaping
Area/skills
Area/transport
Area/vt
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Security
Kind/Testing
perf-regression-accepted
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Blocked
Status
Need More Info
Status
Upstream
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
felis-terminal/felis#224
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?
Problem
Opening a new felis window, or a second window on the current session, from a chord today takes a binding like:
runalways spawns its argv as a transient session over the live grid (start_run→enter_transientincrates/felis-client/src/app_methods.rs), and the window comes back only when the command exits. A window launch (felis) execsfelis-clientand returns only when that new window closes, so["felis"]would cover the origin window for the new window's whole lifetime.open -nis the workaround because it returns at once.opengoes through LaunchServices, so the new window lands in$HOME. Yetrunalready starts in the origin session'sOSC 7directory, and a window launch already starts its first session in the launch cwd (launch_cwdincrates/felis-client-core/src/dial.rs).A dedicated
new_window/duplicate_windowaction is not on the table (docs/explanation/non-goals.md"Window-management chords").Proposal:
background = trueonrundocs/explanation/input.md"Whyrunearns a keybind rather than a WM hotkey" justifiesrunby either (a) the grid-sized transient a redraw-style TUI needs, or (b) the focused session's context (id, cwd) a WM hotkey does not know. Today everyrunpays for (a) even when it needs only (b).Add an optional
backgroundfield torun(defaultfalse; the current behavior is unchanged).input.md"Which daemon runs the command") rests on "the client is a wgpu window, not a PTY host", which a PTY-less spawn does not need.run: cwd is the origin session'sOSC 7directory when it names a local one, withFELIS_ORIGIN_SESSION_ID,FELIS_HOST,FELIS_CWDexported. The environment is scrubbed of inherited origin variables first (#223).OSC 7inherits the local daemon's cwd. A background spawn has no daemon, so it uses the home directory, the fallbackresolve_launch_cwdapplies to an unusable launch cwd. The client's own cwd is not used: a Dock-launched client sits in/.run. It is refused whileis_busy()(a session landing or a pending switch fetch), because the current session id and the shadow screen'sOSC 7may still describe the departing session. It is also refused underrefuse_nested_visit.sh -cplus the env vars is the escape hatch, staying clear of a mini expression language (principle 1).Resulting bindings (default-local recipes):
In a
--hostwindow,felis attach "$FELIS_ORIGIN_SESSION_ID"dials the local daemon, not the remote one; a script can branch onFELIS_HOST. Barefelisinherits no--socket/--config. The reference states both limits.Out of scope
/run/current-system/sw/bin/felis, an absolute~/.nix-profile/bin/felis,/opt/homebrew/bin/felis) avoids the store hash, and the home-manager module can write it. A generalcommand_pathkey with client-side argv[0] resolution was rejected: felis would re-implement the OS executable lookup (execvpsemantics including executable checks and relative PATH entries;CreateProcessWsearching the parent's PATH on Windows). Login-shell environment capture was rejected because it is not portable and runs shell startup code, against REQ-012 on reload.--host/--socket/--config).Cascade
add-config-keyflow (theBindingValue::Runfield,just schema, the home-manager module),docs/reference/keybindings.md(runrow, the background semantics, the cwd fallback, the default-local caveat),docs/explanation/input.md(the (a)/(b) split, the client-spawn exception to "Which daemon runs the command", a note under therunRevisit if: background mode makes unrelated commands easier to bind, while bindings that use the session's id/cwd still pass (b)),skills/felisif it documentsrun, CHANGELOG (Added).Depends on #223.