Configure and run hooks
Needs libtmux for PowerShell 0.x Install
Pass a server, session, window or pane to select a hook table, and choose a hook the scope supports.
- Server hooks are global; tmux has no separate server table.
-Scopeoverrides the scope and-Globalrequests global defaults. Pane-local hooks stay local.
Inspect a configured hook on a previously selected $session:
$session | Get-TmuxHook -Name 'alert-bell'A TmuxHook has a base Name and
Values, an ordered collection of TmuxHookEntry objects
with Index and Command.
Get-TmuxHookaccepts base names only; readValuesfor entries.- Without
-Name, it lists the selected table. - A missing local hook produces no objects.
Set one indexed command and inspect the complete grouped hook:
$command = 'display-message "build finished"'$session | Set-TmuxHook -Name 'alert-bell[7]' -Command $command -PassThru- The command is tmux syntax, not PowerShell. tmux normalizes it, and readback keeps that text so it can be passed back unchanged.
- Without
-PassThru, setting emits nothing. - An unindexed set replaces entries.
-Appendkeeps them and lets tmux pick a free index, which can precede existing sparse indices. Use explicit indices when order matters. - Several changes are not an atomic replacement.
Run a configured base hook without waiting for its event. Invoke-TmuxHook uses
tmux’s target-context lookup: -Scope and -Global do not force a table, and an
indexed name does not select one entry:
$session | Invoke-TmuxHook -Name 'alert-bell'The call confirms tmux accepted it. A hook can start asynchronous work; to see it finish, signal from the hook and wait with Wait-TmuxChannel.
Remove one indexed entry, preserving its neighbours:
$session | Remove-TmuxHook -Name 'alert-bell[7]'Use the base name to remove the whole local hook. Mutations support -WhatIf
and -Confirm, and previews do no tmux I/O. Errors keep the native owner and
core exception. -ErrorAction Continue lets later owners run, and
Stop ends the pipeline. Cancellation cannot undo a command
already sent.