libtmux Reference MCP Search
On this page

libtmux.Session.set_option

View as Markdown

Module
libtmux
Declared in
Session
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
method [source]
method [source]
set_option

Inherited from libtmux.options.OptionsMixin

Set option for tmux target.

Wraps $ tmux set-option <option> <value>.

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
  • option ( str ) – option to set, e.g. 'aggressive-resize'

  • value ( int | str ) – option value. True/False will turn in 'on' and 'off', also accepts string of 'on' or 'off' directly.

Raises

0 declared, 0 inherited

Esc

Type to search.