Window.set_hooks
Set multiple indexed hooks at once.
Source and package
- set_hooks ( self, hook: str, values: Hook
Values , clear_existing: bool = False, global_: bool | None = None, scope: OptionScope | _DefaultOption | None = DEFAULT_OPTION_SCOPE, ) SelfScope -
Inherited from
libtmux.hooks.HooksMixinExamples#
Set hooks with explicit indices:
>>> session.set_hooks('session-renamed', {... 0: 'display-message "hook 0"',... 1: 'display-message "hook 1"',... })Session($...)>>> hooks = session.show_hook('session-renamed')>>> sorted(hooks.keys())[0, 1]>>> session.unset_hook('session-renamed')Session($...)Set hooks from a list (sequential indices):
>>> session.set_hooks('after-new-window', [... 'select-pane -t 0',... 'send-keys "clear" Enter',... ])Session($...)>>> hooks = session.show_hook('after-new-window')>>> sorted(hooks.keys())[0, 1]Replace all existing hooks with
clear_existing=True:>>> session.set_hooks(... 'session-renamed',... {0: 'display-message "new"'},... clear_existing=True,... )Session($...)>>> hooks = session.show_hook('session-renamed')>>> sorted(hooks.keys())[0]>>> session.unset_hook('session-renamed')Session($...)>>> session.unset_hook('after-new-window')Session($...)- Parameters
-
-
hook(str) # – Hook name, e.g. 'session-renamed' -
values(HookValues ) # – Values to set. Can be: - dict[int, str]: {0: 'cmd1', 1: 'cmd2'} - explicit indices - SparseArray[str]: preserves indices from another hook - list[str]: ['cmd1', 'cmd2'] - sequential indices starting at 0 -
clear_existing(bool) # – If True, unset all existing hook values first -
scope(OptionScope | _DefaultOption | None) # – Scope for the hookScope
-
- Returns
-
Self Returns self for method chaining.
tmux catalog Hooks
In other ports Write a window hook and its indexed commands at once
- PowerShell No source-verified PowerShell equivalent is recorded for this operation.
- Julia No source-verified Julia equivalent is recorded for this operation.
- Ruby No source-verified Ruby equivalent is recorded for this operation.
- Lua No source-verified Lua equivalent is recorded for this operation.
- TypeScript no equivalent on
Window - Rust
- Go
- Java no equivalent on
Window - C# no equivalent on
Window - C++ no equivalent on
Window - Swift no equivalent on
Window - Kotlin No source-verified Kotlin equivalent is recorded for this operation.
- Scala No source-verified Scala equivalent is recorded for this operation.
- F# No source-verified F# equivalent is recorded for this operation.