Skip to content
animfetch
Menu

Usage

Keeping your scrollback (kitty)

In kitty, give the pinned art a split of its own so old commands stay scrollable.

A pinned fetch shares the screen with your shell, and that costs you something: output that scrolls away under the art cannot be scrolled back to.

Terminals save a line to scrollback only when it leaves the top row of the screen. --pin holds the top rows still with a scroll region, so a command's output leaves the region below the art, and the terminal throws it away. In a test in kitty, 40 of 200 printed lines could still be read.

In kitty, animfetch can draw the art in a split of its own above your shell instead. The art stays at the top, and the shell below it keeps its whole scrollback, which scrolls with the mouse wheel, selection and search as ever.

This works in kitty only, and needs four lines of settings, once. Without them, and in every other terminal, --pin works as it always has.

Set it up#

Tested with kitty 0.48.2 on Linux.

1. Add these to ~/.config/kitty/kitty.conf:

# animfetch: pin into a split, and keep the scrollback
allow_remote_control socket-only
listen_on unix:${XDG_RUNTIME_DIR}/kitty-{kitty_pid}.sock
confirm_os_window_close -2
window_border_width 0
LineNeededWhat it is for
allow_remote_control socket-onlyyesLets animfetch ask kitty for the split.
listen_on …yesThe socket it asks through.
confirm_os_window_close -2recommendedWithout it, closing a pinned window asks whether you are sure, because the art counts as a running program. With -2 kitty asks only if something besides the art is running.
window_border_width 0optionalNo outline around the splits, so the art and the shell read as one window. It applies to all of your kitty splits.

Leave out the confirm_os_window_close line if you have already set it to 0. Kitty still asks when one window holds two or more pinned tabs or splits.

Read this first. allow_remote_control socket-only lets any program running as you control kitty through that socket, including reading its windows and typing into them. Programs that only reach your terminal, such as those on a machine you ssh into, cannot. Add it only if you are content with that.

2. Quit kitty, closing every window, and start it again. Reloading the settings is not enough.

3. Try it, then scroll up. You should reach line 1, with the art still on top:

sh
animfetch --pin
seq 200

Nothing else changes. animfetch --pin in your shell startup now opens the split by itself, and animfetch --unpin closes it.

How the split behaves#

  • The tab is switched to kitty's splits layout. Windows already in a tab that used another layout are rearranged.
  • The art's split closes along with its shell.
  • Full-screen programs, such as vim, get the room below the art, which goes on animating.
  • Resizing the window refits the art. Typing into the art's split sends the keyboard back to the shell.
  • A picker such as animfetch theme hides the art's split while it is open and uses the whole window, and the split comes back, as it was, when you leave it.
  • In a short window the art is raised so that all of it stays in view.

If it does not work#

Where kitty cannot be used this way, --pin shares the screen as it always has. When kitty refuses, animfetch says why on the first line.

What you seeWhat to do
Old output still disappears, with no messageRun echo $KITTY_LISTEN_ON. It should print a path starting unix:. If it is empty, check the two required lines and restart kitty. The split is also not used inside tmux, or if TERM is not xterm-kitty.
no kitty split … The layout splits is unknown or disabledAdd splits to your enabled_layouts.
no kitty split … with another reasonUse allow_remote_control socket-only or yes. Password-protected remote control is not supported.
Nothing changes in a window that was already pinnedRun animfetch --unpin, then animfetch --pin.
Closing the window asks "are you sure?"Set confirm_os_window_close -2, as above.

macOS has not been tested. It does not set XDG_RUNTIME_DIR, so name another directory that only you can write to, for example listen_on unix:${TMPDIR}/kitty-{kitty_pid}.sock.

Turning it off#

Remove the lines from kitty.conf and restart kitty. To pin in place just once, run animfetch --unpin, then:

sh
env -u KITTY_LISTEN_ON animfetch --pin