# libtmux::Server

- **Module:** libtmux
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/393d4b0ad666f18a6581f1eb281741a75a7503f0/include/libtmux/server.hpp#L489
- **Page:** https://libtmux.org/en/cxx/latest/reference/libtmux-server/

One tmux server, addressed by the socket it listens on.

The entry point: sessions, windows and panes are read from here and carry the server with them. Constructing a handle sends no command. Only a startable handle may create an absent daemon; ordinary handles never do.

## Members

- `at_socket_path` (method): `-S path`: the socket file, used verbatim.
- `at_socket_name` (method): `-L name`: resolved under tmux's socket directory, as the tmux flag does.
- `startable_at_socket_path` (method): A socket handle that may create an absent server on its first `new_session` call or an explicit `run({"start-server"})`.
- `startable_at_socket_name` (method)
- `startable_at_default` (method)
- `from_env` (method): The server this process is running inside.
- `at_default` (method): The server tmux would talk to with no `-L` or `-S` at all, which is the one a person means when they say "my tmux".
- `over` (method): A Server over a transport the caller supplies.
- `capabilities` (method): The local backend contract; no command runs.
- `socket_path` (method): The resolved path pinned by this handle, including a startable path whose server has not been created yet.
- `run` (method): Run one command and return its standard output.
- `try_submit` (method): Admit one command to an explicit bounded runtime without waiting for it.
- `run_batch` (method): Run several commands in one invocation.
- `run_chain` (method): Run a chain.
- `control` (method): Open a control-mode connection to one session.
- `control_with_options` (method): The Server supplies the socket and `session` supplies the session name; every other connection option is kept, including pane output policy.
- `over_control` (method): A Server whose commands travel over held-open control clients attached to `session`, rather than one launched process each.
- `tmux_version` (method): Ask the selected subprocess executable with `tmux -V` without touching a server.
- `is_alive` (method): Whether a server is answering on this socket.
- `check_alive` (method): The same question, keeping why the answer was no.
- `kill` (method): End the server and everything in it.
- `sessions` (method): One snapshot each.
- `windows` (method): tmux scopes window and pane listings to the current session unless asked for every one, so `-a` is part of the request rather than a caller's responsibility to remember.
- `panes` (method)
- `clients` (method)
- `wait_for` (method): Block until someone signals this channel, or the deadline passes.
- `signal` (method): Release whoever is waiting on the channel, or latch it for whoever waits next.
- `commands` (method): Every command this tmux understands, with its alias and usage.
- `buffers` (method): The server's cut buffers, newest first as tmux orders them.
- `load_buffer` (method): Read a file into a named buffer, and write one back out.
- `save_buffer` (method)
- `bind_key` (method): Bind a key in a key table, and take a binding away again.
- `unbind_key` (method): Unbinding a key that was not bound succeeds; unbinding in a table that does not exist is refused.
- `run_shell` (method): Run a shell command on the machine the server is on.
- `source_file` (method): Run the commands in a file, the way tmux runs a configuration file.
- `check_file` (method): Parse the same file and report what tmux would refuse in it, running none of it.
- `expand` (method): Ask tmux to expand a format, against no target but the server itself.
- `show_message` (method): Put a message on the status line of every attached client, and send it to each control client as `message`.
- `set_buffer` (method): Put text in a named buffer, replacing what was there.
- `session` (method): One object by target, for a caller holding an id or a `session:window` path that came from somewhere else.
- `window` (method)
- `pane` (method)
- `wait_for_text` (method): Wait until the pane `target` names produces `wanted`.
- `new_session` (method): Created detached, and returned, because tmux prints what it made.
- `options` (method)
- `server_options` (method): The server's own options, which are neither session nor window options and are the only ones a server without a session still has.
- `set_server_option` (method)
- `global_options` (method)
- `set_global_option` (method): Sets the value every session inherits, rather than one session's own.
- `hooks` (method)
- `environment` (method): The environment every new process on this server starts with.
- `set_environment` (method): Bind a name.
- `unset_environment` (method): Forget the name, so a new process inherits whatever the tmux server itself has.
- `remove_environment` (method): Keep the name and take it out of what a new process inherits — tmux's `-r`, which a listing then prints as `-NAME`.
- `global_hooks` (method): A hook set globally is not reported by the unscoped listing, so reading it back needs the scope it was set with.
- `set_global_hook` (method)
