Skip to content

Add tmuxp lobby to list local tmux servers and -L/-S commands #1127

Backlog

Description

@tony

Summary

tmuxp ls lists YAML and JSON workspace files on disk rather than running tmux servers, leaving users who work across multiple -L or -S sockets no tmuxp command to inspect active servers and sessions. Adding a tmuxp lobby subcommand backed by libtmux local server discovery (tmux-python/libtmux#764) lets tmuxp scan local sockets without starting dead servers and display the exact -L or -S commands to target each one. Supporting non-interactive output (human, --json, --ndjson) by default alongside an opt-in interactive selector covers both shell scripting and quick terminal switching.

Motivation

In tmuxp v1.84.0 (e250218), tmuxp load, tmuxp freeze, and tmuxp shell already accept -L <socket-name> and -S <socket-path>, whereas tmuxp ls inspects workspace files in the current directory tree and ~/.tmuxp/ without querying any tmux daemon. Users running isolated development, test, or agent servers across /tmp/tmux-<uid>/, $TMUX_TMPDIR, $TMUX, or project-local socket paths have to list socket directories manually, probe which sockets are alive versus stale, and hand-construct -L or -S flags for tmuxp and tmux.

Distinguishing -L from -S is error-prone by hand. A socket inside tmux's active socket directory (/tmp/tmux-<uid>/<name> or $TMUX_TMPDIR/tmux-<uid>/<name>) is addressable via -L <name>, whereas a socket at any other path requires -S <socket-path> because -L resolves only inside tmux's default directory.

Evidence

In tmuxp v1.84.0:

Upstream in tmux-python/libtmux#764 (with final API naming tracked in tmux-python/libtmux#924), TmuxLobby scans /tmp/tmux-<uid>, $TMUX_TMPDIR, $TMUX, and custom paths or patterns with bounded non-starting probes, returning QueryList[TmuxLobbyServer] entries carrying alive, server, socket_name, socket_path, uid, pid, version, error, and .sessions / .windows / .panes.

Socket flag definitions in tmuxp v1.84.0

src/tmuxp/cli/load.py lines 748-761:

    parser.add_argument(
        "-L",
        dest="socket_name",
        metavar="socket_name",
        action="store",
        help="passthru to tmux(1) -L",
    )
    parser.add_argument(
        "-S",
        dest="socket_path",
        metavar="socket_path",
        action="store",
        help="passthru to tmux(1) -S",
    )

Proposal

  • Add tmuxp lobby (src/tmuxp/cli/lobby.py) backed by libtmux's server discovery API (tmux-python/libtmux#764 / tmux-python/libtmux#924), supporting --path and --pattern for extra socket locations plus --all to show stale or unresponsive sockets (alive=False, with probe error text) alongside live servers.
  • Default to non-interactive output through OutputFormatter (human, --json, --ndjson, and --tree to expand each server's sessions, window counts, and attached clients) with PrivatePath home-directory masking.
  • Display ready-to-run tmuxp and tmux commands per discovered server, selecting -L <socket-name> when socket_path sits directly inside tmux's active socket directory and -S <socket-path> otherwise (shell-escaped via shlex.quote): for example tmuxp load -L work <workspace>, tmuxp shell -L work, tmuxp freeze -L work <session>, and tmux -L work attach (or -S ./dev.sock for custom paths).
  • Add an opt-in interactive display (-i / --interactive on a TTY) that lists live servers and sessions and lets the user attach (attach outside tmux, switch-client when $TMUX is set), open tmuxp shell, or run tmuxp freeze against the selected target.

Alternatives

Adding a --servers flag to tmuxp ls would avoid introducing a new top-level subcommand, at the cost of coupling static YAML and JSON file discovery (workspaces and global_workspace_dirs in tmuxp ls --json) with live socket probes and divergent JSON schemas. Leaving users to inspect /tmp/tmux-$(id -u) by hand misses $TMUX_TMPDIR, $TMUX, and project-local sockets, and bare tmux commands against stale sockets risk starting unintended daemons or hanging without a probe timeout. Dedicating tmuxp lobby to live server discovery keeps tmuxp ls focused on workspace files while aligning with libtmux's discovery vocabulary.

References

  • Upstream TmuxLobby pull request: tmux-python/libtmux#764
  • Upstream local server discovery API selection: tmux-python/libtmux#924
  • Related socket-in-configuration feature request: Set socket in configuration #577

Activity

  1. added
    new-feature
    on Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions