Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux latest

OptionsMixin.set_option

Set option for tmux target.

Source and package
Qualified name
libtmux.options.OptionsMixin.set_option
Module
libtmux.options
Declared in
OptionsMixin
Package
libtmux
Source
src/libtmux/options.py
set_option
( 11 parameters ) ( self, option: str, value: int | str, _format: bool | None = None, prevent_overwrite: bool | None = None, ignore_errors: bool | None = None, suppress_warnings: bool | None = None, append: bool | None = None, g: bool | None = None, global_: bool | None = None, scope: OptionScope | _DefaultOptionScope | None = DEFAULT_OPTION_SCOPE, )
→ Self

Examples#

>>> import typing as t
>>> from libtmux.common import tmux_cmd
>>> from libtmux.constants import OptionScope
>>> from libtmux._internal.sparse_array import SparseArray
>>> class MyServer(OptionsMixin):
... socket_name = server.socket_name
... def cmd(self, cmd: str, *args: object):
... cmd_args: t.List[t.Union[str, int]] = [cmd]
... if self.socket_name:
... cmd_args.insert(0, f"-L{self.socket_name}")
... cmd_args.insert(0, "-f/dev/null")
... return tmux_cmd(*cmd_args, *args)
...
... default_option_scope = OptionScope.Server
>>> MyServer().set_option('escape-time', 1250)
<libtmux.options.MyServer object at ...>
>>> MyServer()._show_option('escape-time')
1250
>>> MyServer().set_option('escape-time', 495)
<libtmux.options.MyServer object at ...>
>>> MyServer()._show_option('escape-time')
495
Parameters
Raises

tmux command#

The tmux commands behind set_option.

tmux C API#

The C declarations in tmux that implement these commands.

tmux options#

Settings for the server, sessions, windows and panes, with their types, defaults and allowed values.

Esc

Type to search.

Reference previewOpen reference