Created
April 1, 2025 19:00
-
-
Save LaptopDev/5e4310e4b76f333df05aa0cf059a2b1e to your computer and use it in GitHub Desktop.
shell function for kitty to dump the pane screen content to new file to prevent overwrite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dump () | |
{ | |
local id="$1"; | |
local dir="/tmp/pane_dump"; | |
local base="pane"; | |
local index=1; | |
local file; | |
if [ -z "$id" ]; then | |
echo "Usage: dump <pane-id>" 1>&2; | |
return 1; | |
fi; | |
mkdir -p "$dir"; | |
while [ -e "$dir/${base}${index}" ]; do | |
index=$((index + 1)); | |
done; | |
file="$dir/${base}${index}"; | |
kitty @ get-text --match id:"$id" --extent=all > "$file"; | |
echo "Dumped to $file"; | |
cat "$file" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment