Then build a tmux session switcher. libtmux drives a real tmux server from code. It gives you objects for the server, its sessions, windows and panes. Documentation for every language is at https://libtmux.org/en/. Language: Python Package: libtmux (PyPI) Repository: https://github.com/tmux-python/libtmux Read these before writing code: - https://libtmux.org/en/py/latest/llms.txt every page for Python, as a list - https://libtmux.org/en/py/latest/docs.json the same list with headings, as JSON - https://libtmux.org/en/py/latest/reference/ the Python API reference If you cannot fetch URLs, clone the repository above and read its README and examples instead, or ask me to paste those pages in. Set up first: 1. Report the tmux version with `tmux -V`. libtmux drives a real tmux, so nothing below works without one. Stop and tell me if it is missing. 2. If this directory is not a Python project yet, start one: uv init Skip this in a project that already exists, and match what is here. 3. Add the dependency. libtmux 0.62.0 is the current release on PyPI. uv add libtmux Check https://pypi.org/project/libtmux/ if you need a different version. If this project already uses pip, Poetry or PDM, add the dependency with that tool instead: the package is the same. 4. Write the smallest program that proves the install works: connect to a tmux server, create a session, confirm it is there, then kill it. Give that server a socket of its own rather than using the default one, so this never touches a tmux I am already running. Run it, and show me the output and the files you added. Rules for everything below: - Use the reference above rather than guessing names. The ten libtmux ports do not share spellings, and a name from another language will look plausible and not exist. - If the reference does not have something you expected, say so instead of writing a call that does not exist. - Follow the conventions already in this repository. Session switcher What it does: - Lists every session on the server with its windows, and shows what each window's active pane is running, so the list says something more useful than a set of names. - Filters as I type and attaches to, or switches the client to, what I pick. - Works both from outside tmux and from inside it. Those need different calls, and getting the inside case wrong is the usual bug here: attaching from within a session nests one client inside another. Constraints: - Read the live server every time. Do not cache a session list between runs. - Handle there being no server running at all, which is the first-run case. - Fetch the listing in as few round trips as the API allows and say how many it costs. One call per pane is the slow shape this should avoid. - Keep it to one file I can read in a sitting. Anchor it in these pages: - https://libtmux.org/en/tmux/concepts/queries/ queries - https://libtmux.org/en/tmux/guides/querying-and-filtering/ querying and filtering - https://libtmux.org/en/tmux/guides/attaching-to-tmux/ attaching to tmux