feat(watcher): add scrollback history logging on window/pane close #2
Reference in New Issue
Block a user
Delete Branch "feat-scrollback-watcher"
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
watcher.py— a kitty Python watcher that captures terminal scrollback to~/.terminal_history/on every window or pane close, regardless of how the terminal is closed (Ctrl+D, keybind, clicking X, full kitty quit)kitty.confwatcher directive: removes invalid--type=globalprefix that caused aFileNotFoundErroron every kitty startup, meaning the watcher was never loadedREADME.mdHow it works
Two components handle logging:
smart_exit(existing) — intercepts gracefulexitcalls, logs scrollback viakitty @, and setslogged_by_shell=trueon the window to signal the Python watcher to skip itwatcher.py(new) — registerson_close(fires per window on destruction) andon_quit(fires when kitty quits, iterates all windows) hooks; skips windows already logged by the shell or already logged in this sessionManual Verification
journalctl --user _COMM=kittyCtrl+D— verify a newscrollback_*.logappears in~/.terminal_history/exitin a fish shell — verify only one log is created (not duplicated by both fish and watcher)