fix(zellij): repair scrollback logging on shell exit
The zellij wrapper (functions/zellij.fish) rewrote every `zellij` invocation as `zellij options --theme catppuccin-mocha <args>`, which is only valid for launching a new session. This mangled every subcommand, including the `zellij action dump-screen` call inside _zellij_dump_log, so no logs were ever produced. The theme is already set in config.kdl, making the wrapper redundant — remove it. Also harden _zellij_dump_log: - dump-screen takes the file via stdout redirect, not a positional arg (rejected by zellij 0.44) nor --path (server-side write, flaky) - add --ansi to preserve color in the logs - discard empty dumps instead of leaving junk files Document the structural limitation: zellij can only snapshot on a clean shell exit, unlike tmux's continuous pipe-pane stream. Closing a pane or quitting zellij tears down the pane/server before it can be dumped.
This commit is contained in:
@@ -34,7 +34,12 @@ function _zellij_dump_log --description 'Dump the current Zellij pane scrollback
|
||||
set -l log_file "$log_dir/zellij_"$session"-p"$pane_id"_"$timestamp".log"
|
||||
|
||||
mkdir -p $log_dir
|
||||
zellij action dump-screen --full "$log_file" 2>/dev/null
|
||||
# Dump to STDOUT and let this fish process write the file. `--path` makes the
|
||||
# zellij *server* write the file (its CWD/permissions, historically flaky);
|
||||
# capturing STDOUT keeps the write client-side and reliable. Drop the empty
|
||||
# file if the dump produced nothing (e.g. pane already torn down on exit).
|
||||
zellij action dump-screen --full --ansi >"$log_file" 2>/dev/null
|
||||
test -s "$log_file"; or command rm -f "$log_file"
|
||||
|
||||
_prune_terminal_logs zellij
|
||||
end
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# SYNOPSIS
|
||||
# zellij [args...]
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Launches zellij with the Catppuccin Mocha theme applied via
|
||||
# --theme catppuccin-mocha.
|
||||
#
|
||||
# ARGUMENTS
|
||||
# args... Arguments forwarded to zellij
|
||||
#
|
||||
# EXAMPLE
|
||||
# zellij
|
||||
function zellij --wraps='zellij' --description 'alias zellij=zellij options --theme catppuccin-mocha'
|
||||
command zellij options --theme catppuccin-mocha $argv
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user