feat(c5): multiplexer session logging (tmux + zellij) #53
Reference in New Issue
Block a user
Delete Branch "feat/tmux-logging"
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?
Summary
Extends C5 logging to terminal multiplexers, with two mechanisms suited to each:
conf.d/tmux-logging.fish→functions/_tmux_pipe_log.fish): startstmux pipe-paneto stream the pane continuously to~/.terminal_history/tmux_<session>-w<win>-p<pane>_<ts>.logwhenever fish launches inside tmux. Toggling__fish_config_op_loggingstops/restarts the stream in every open shell via the existing--on-variablehandlers.conf.d/zellij-logging.fish→functions/_zellij_dump_log.fish): zellij has no live-stream facility, so afish_exithandler snapshots the pane withzellij action dump-screen --fullon shell exit, written to~/.terminal_history/zellij_<session>-p<pane>_<ts>.log. The C5 guard is re-checked inside the handler at exit time, so toggling logging needs no sentinel/sync coordination.functions/_prune_terminal_logs.fish): both helpers delegate max-file pruning here, keeping each prefix withinSCROLLBACK_HISTORY_MAX_FILESby mtime — mirroring the paru/yay wrappers.Why not a
tmuxfunction wrapper?A
tmuxshell-function wrapper only fires when you typetmux. Panes created via tmux keybindings (prefix+c, splits) are spawned by the tmux server and never go through your shell, so a wrapper would miss them. The conf.d startup hook catches every pane because each one starts a fresh shell.Bugs caught while building
tmux_*.logdirectly errored withNo matches for wildcardon the first log in an empty dir. The shared helper globs viaset(tolerates no-match).command ls/command rm: barelsis the eza shadow (injects OSC-8 escapes that corrupt paths) and barermis the trash wrapper. The paru/yay wrappers sidestep this by being bash.Manual Verification
tmux
~/.terminal_history/tmux_*.logis created and captures command outputset -U __fish_config_op_logging 0→ pipe-pane stops;set -Ue __fish_config_op_logging→ resumes with a new logzellij
exit→ confirm~/.terminal_history/zellij_*.logexists with the pane scrollbackset -U __fish_config_op_logging 0, exit a zellij pane → confirm no zellij log is writtenpruning / general
SCROLLBACK_HISTORY_MAX_FILESand open many panes/exits → confirm oldesttmux_*/zellij_*logs are pruned to the limit~/.terminal_history→ confirm noNo matches for wildcarderror at startupset -U __fish_config_opinionated 0disables both tmux and zellij capture (master override)Fish does not support bash-style ${var} brace syntax. Build the log file path in a dedicated variable using quote-splicing instead.feat(c5): tmux pipe-pane session loggingto feat(c5): multiplexer session logging (tmux + zellij)