Skip to content

Sessions

Saumyadip edited this page Nov 6, 2026 · 4 revisions

Sessions

Think of ananta as two pieces that work together:

  • The server — a background program that owns every pane, runs your shell commands, and keeps everything alive.
  • The client — the thin program you type in inside your terminal. It only sends keystrokes and draws frames.

Because the server is separate, you can close your terminal, drop your SSH connection, or reboot your computer, and your panes keep running. Come back later and reattach — nothing is lost.

📸 Screenshot coming here: Diagram showing client and server connected by a unix socket. 🎬 Video coming here: Detach, close terminal, reattach later — your work is still there.

The idea in one picture

You type in a terminal (client)
              ↓ keystrokes
   ┌─────────────────────┐
   │   ananta server     │  ← owns panes, PTYs, scrollback
   │ (runs in background)│
   └─────────────────────┘
              ↑ frames to draw
   You see output in your terminal (client)

Session commands

Command What it does
ananta Attach to session "main" (create it if needed)
ananta -s work Attach to session "work"
ananta new work Create session "work" and attach (error if it exists)
ananta attach work Attach to an existing session
ananta ls List all live sessions (panes, attached/detached)
ananta kill work End a session and every program in it
ananta local Run without a background session (closes when the terminal closes)

📸 Screenshot coming here: Output of ananta ls showing one attached and one detached session. 🎬 Video coming here: Creating, listing, and killing sessions.

Detach and reattach

Inside ananta, press alt+d to detach. The server keeps running and your panes keep producing output. Close your terminal or drop SSH — it does not matter.

Come back later:

ananta            # attach to "main"
ananta -s work    # attach to "work"
ananta attach work

When you reattach, everything is re-laid out for your new terminal size, and the scrollback that filled while you were away is all still there.

Only one client can be attached to a session at a time. If you attach from a second terminal, the first client is told to leave and exits with a notice. This is handy for moving between machines.

Control a running session from anywhere

Once a session is running, any shell or script can drive it. The program always goes in double quotes, as one argument:

ananta open "htop" -n 3 -w 0.33 -s test   # htop, workspace 3, 33% wide, session "test"
ananta open "tail -f /var/log/syslog" --below
ananta open "make watch" -k               # -k: keep keyboard focus where it is
ananta open                                # no program: a new shell
ananta workspace 3                         # switch the view
ananta focus left                          # left | right | up | down
ananta width 50%                           # resize the focused column
ananta send -e "make test"                 # type into a pane (-e presses Enter)
ananta close                               # close the focused pane
ananta list                                # list panes (id, workspace, column, width, program)
ananta action overview                     # run any action by name
ananta action goto_workspace 2

Flags may go before or after the program. -s NAME picks the session; otherwise it defaults to the session you are inside (every pane has ANANTA_SESSION and ANANTA_PANE set), else main.

Inside ananta local there is no session, so name one with -s.

open starts the program in the directory you ran the command from (-d DIR to choose another).

📸 Screenshot coming here: Terminal running ananta open "htop" and ananta list. 🎬 Video coming here: Controlling a running session from another terminal window.

Files on disk

Everything lives under $XDG_RUNTIME_DIR/ananta-<uid>/ (or the temp folder), mode 0700:

File Purpose
NAME.sock The unix socket clients connect to
NAME.log The server's output, useful for crash reports

Session names may contain letters, digits, ., _, - (up to 48 characters).

📸 Screenshot coming here: The session socket and log files on disk. 🎬 Video coming here: Finding the logs when something goes wrong.

Ending a session

  • leader+Q inside the session — ends it; attached clients get "session ended".
  • ananta kill NAME — from any terminal.
  • leader+d / alt+d only detaches; the session keeps running and can be re-attached later.

There is no saved session state on disk. A session exists only while its server is running. If the machine restarts, sessions are gone — like tmux without plugins.

🎬 Video coming here: The difference between detach and kill.

Clone this wiki locally