Table of Contents

Interface IPluginHost

Namespace
WTmux.Core.Plugins
Assembly
WTmux.Core.dll

Host interface provided to plugins for interacting with wtmux.

public interface IPluginHost

Properties

Config

Gets the current configuration.

WtmuxConfig Config { get; }

Property Value

WtmuxConfig

Methods

BindKey(byte, string)

Registers a key binding. The action receives the key byte.

void BindKey(byte key, string command)

Parameters

key byte
command string

BindMouse(string, string)

Binds a named mouse key (e.g. WheelUpPane) to a command. Unknown names are ignored.

void BindMouse(string mouseKey, string command)

Parameters

mouseKey string
command string

BindRootKey(byte, string)

Binds a key in the root (no-prefix) key table.

void BindRootKey(byte key, string command)

Parameters

key byte
command string

GetUserOption(string)

Gets the value of a tmux-style user option (@name), or an empty string when unset. Plugins set user options via SetOption(string, string) (e.g. SetOption("@my_plugin_theme", "dark")).

string GetUserOption(string name)

Parameters

name string

Returns

string

Log(string)

Logs a message for debugging.

void Log(string message)

Parameters

message string

OnSessionCreated(Action<SessionEventArgs>)

Registers a handler called when a session is created.

void OnSessionCreated(Action<SessionEventArgs> handler)

Parameters

handler Action<SessionEventArgs>

OnSessionEnded(Action<SessionEventArgs>)

Registers a handler called when a session ends.

void OnSessionEnded(Action<SessionEventArgs> handler)

Parameters

handler Action<SessionEventArgs>

RegisterFormatVariable(string, Func<FormatContext, string>)

Registers a custom status bar format variable. When #{name} is encountered in format strings, the provider is called.

void RegisterFormatVariable(string name, Func<FormatContext, string> provider)

Parameters

name string
provider Func<FormatContext, string>

RunCommand(string)

Executes a wtmux command in the server's global context (there is no attached client). Client-independent commands work — global option changes (set-option -g), config commands (source-file, reload-config), key bindings (bind, unbind), and queries (show-option). Commands that act on the current client/session (e.g. new-window, split-window, display-message, send-keys) are not supported from this context and return a failure. Returns the command's success state and any textual output.

PluginCommandResult RunCommand(string command)

Parameters

command string

Returns

PluginCommandResult

SetOption(string, string)

Sets a configuration option.

void SetOption(string option, string value)

Parameters

option string
value string

UnbindKey(byte)

Removes a key binding.

void UnbindKey(byte key)

Parameters

key byte

UnbindMouse(string)

Removes a mouse-key binding (and suppresses its built-in default).

void UnbindMouse(string mouseKey)

Parameters

mouseKey string

UnbindRootKey(byte)

Removes a root-table key binding.

void UnbindRootKey(byte key)

Parameters

key byte