feat(c5): prune old tmux logs and share pipe-pane helper
Extract the tmux pipe-pane setup into functions/_tmux_pipe_log.fish, called by both conf.d/tmux-logging.fish (startup) and __fish_config_sync_logging (C5 re-enable). The helper prunes the oldest tmux_*.log files by mtime to stay within SCROLLBACK_HISTORY_MAX_FILES, matching the paru/yay wrappers. Uses 'command ls' to bypass the eza ls shadow, which injects OSC-8 hyperlink escapes into paths and corrupted the filenames passed to rm.
This commit is contained in:
@@ -11,10 +11,4 @@ status is-interactive; or exit
|
||||
type -q tmux; or exit
|
||||
set -q TMUX; or exit
|
||||
|
||||
set -l log_dir (set -q SCROLLBACK_HISTORY_DIR; and echo $SCROLLBACK_HISTORY_DIR; or echo "$HOME/.terminal_history")
|
||||
set -l pane_id (tmux display-message -p '#{session_name}-w#{window_index}-p#{pane_index}' 2>/dev/null)
|
||||
set -l timestamp (date "+%Y-%m-%d_%H-%M-%S")
|
||||
set -l log_file "$log_dir/tmux_"$pane_id"_"$timestamp".log"
|
||||
|
||||
mkdir -p $log_dir
|
||||
tmux pipe-pane "cat >> $log_file" 2>/dev/null
|
||||
_tmux_pipe_log
|
||||
|
||||
Reference in New Issue
Block a user