fix(logging): suppress Kitty watcher capture when C5 logging is disabled
When smart_exit skips fish-side capture due to the C5 guard, it now sets logged_by_shell=true on the Kitty window before calling builtin exit. This prevents watcher.py's on_close handler from capturing the scrollback even if the sentinel file is absent, providing a second layer of protection. Also restructures the capture block to be flat (no wrapper if-true) after the early-exit guard.
This commit is contained in:
@@ -48,8 +48,16 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# C5 — Logging & Capture: skip all capture when logging is disabled
|
# C5 — Logging & Capture: skip all capture when logging is disabled.
|
||||||
if __fish_config_op_enabled __fish_config_op_logging
|
# When disabled, tell Kitty the window is handled so its watcher doesn't
|
||||||
|
# capture either — belt-and-suspenders alongside the sentinel file.
|
||||||
|
if not __fish_config_op_enabled __fish_config_op_logging
|
||||||
|
if test -n "$KITTY_WINDOW_ID"
|
||||||
|
kitty @ set-user-vars "logged_by_shell=true" 2>/dev/null
|
||||||
|
end
|
||||||
|
builtin exit
|
||||||
|
end
|
||||||
|
|
||||||
set -l snapshot_dir (set -q SCROLLBACK_HISTORY_DIR; and echo $SCROLLBACK_HISTORY_DIR; or echo "$HOME/.terminal_history")
|
set -l snapshot_dir (set -q SCROLLBACK_HISTORY_DIR; and echo $SCROLLBACK_HISTORY_DIR; or echo "$HOME/.terminal_history")
|
||||||
set -l max_files (set -q SCROLLBACK_HISTORY_MAX_FILES; and echo $SCROLLBACK_HISTORY_MAX_FILES; or echo 100)
|
set -l max_files (set -q SCROLLBACK_HISTORY_MAX_FILES; and echo $SCROLLBACK_HISTORY_MAX_FILES; or echo 100)
|
||||||
|
|
||||||
@@ -94,7 +102,6 @@ function smart_exit --description 'Capture colorized scrollback before exiting,
|
|||||||
echo -e "$c_warn""➔""$c_reset Exiting discreetly; $c_bold""no history logs saved.""$c_reset"
|
echo -e "$c_warn""➔""$c_reset Exiting discreetly; $c_bold""no history logs saved.""$c_reset"
|
||||||
sleep 0.4
|
sleep 0.4
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Call the true system exit directly
|
# Call the true system exit directly
|
||||||
builtin exit
|
builtin exit
|
||||||
|
|||||||
Reference in New Issue
Block a user