Plugin - tmuxp.plugin

Plugin system for tmuxp.

tmuxp.plugin.TMUX_MIN_VERSION = '1.8'

Minimum version of tmux required to run libtmux

tmuxp.plugin.TMUX_MAX_VERSION = None

Most recent version of tmux supported

tmuxp.plugin.LIBTMUX_MIN_VERSION = '0.8.3'

Minimum version of libtmux required to run libtmux

tmuxp.plugin.LIBTMUX_MAX_VERSION = None

Most recent version of libtmux supported

tmuxp.plugin.TMUXP_MIN_VERSION = '1.6.0'

Minimum version of tmuxp required to use plugins

tmuxp.plugin.TMUXP_MAX_VERSION = None

Most recent version of tmuxp

class tmuxp.plugin.Config[source]

Bases: TypedDict

tmuxp plugin configuration mapping.

plugin_name: str
tmux_min_version: str
tmux_max_version: Optional[str]
tmux_version_incompatible: Optional[list[str]]
libtmux_min_version: str
libtmux_max_version: Optional[str]
libtmux_version_incompatible: Optional[list[str]]
tmuxp_min_version: str
tmuxp_max_version: Optional[str]
tmuxp_version_incompatible: Optional[list[str]]
tmuxp.plugin.validate_plugin_config(config)[source]

Return True if tmuxp plugin configuration valid, also upcasts.

Return type:

TypeGuard[Config]

tmuxp.plugin.setup_plugin_config(config, default_config={'libtmux_max_version': None, 'libtmux_min_version': '0.8.3', 'libtmux_version_incompatible': None, 'plugin_name': 'tmuxp-plugin', 'tmux_max_version': None, 'tmux_min_version': '1.8', 'tmux_version_incompatible': None, 'tmuxp_max_version': None, 'tmuxp_min_version': '1.6.0', 'tmuxp_version_incompatible': None})[source]

Initialize tmuxp plugin configuration.

Return type:

Config

class tmuxp.plugin.TmuxpPlugin(**kwargs)[source]

Bases: object

Base class for a tmuxp plugin.

_version_check()[source]

Check all dependency versions for compatibility.

Return type:

None

_pass_version_check(version, vmin, vmax, incompatible)[source]

Provide affirmative if version compatibility is correct.

Return type:

bool

before_workspace_builder(session)[source]

Provide a session hook previous to creating the workspace.

This runs after the session has been created but before any of the windows/panes/commands are entered.

Return type:

None

Parameters:

session (libtmux.Session) – session to hook into

on_window_create(window)[source]

Provide a window hook previous to doing anything with a window.

This runs runs before anything is created in the windows, like panes.

Return type:

None

Parameters:

window (libtmux.Window) – window to hook into

after_window_finished(window)[source]

Provide a window hook after creating the window.

This runs after everything has been created in the window, including the panes and all of the commands for the panes. It also runs after the options_after has been applied to the window.

Return type:

None

Parameters:

window (libtmux.Window) – window to hook into

before_script(session)[source]

Provide a session hook after the workspace has been built.

This runs after the workspace has been loaded with tmuxp load. It augments instead of replaces the before_script section of the workspace data.

This hook provides access to the LibTmux.session object for any behavior that would be used in the before_script section of the workspace file that needs access directly to the session object. This runs after the workspace has been loaded with tmuxp load.

The hook augments, rather than replaces, the before_script section of the workspace. While it is possible to do all of the before_script workspace in this function, if a shell script is currently being used for the workspace, it would be cleaner to continue using the script in the before_section.

If changes to the session need to be made prior to anything being built, please use before_workspace_builder instead.

Return type:

None

Parameters:

session (libtmux.Session) – session to hook into

reattach(session)[source]

Provide a session hook before reattaching to the session.

Return type:

None

Parameters:

session (libtmux.Session) – session to hook into