Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-swift latest

Server.setHook(_:to:at:in:)

Binds a command to a hook.

Source and package
Qualified name
Server.setHook(_:to:at:in:)
Declared in
Server
Package
libtmux-swift
Source
Sources/LibTmux/Options.swift
Other languages
Perlmethod Erlang PowerShell Julia Elixir Haskell Common Lisp Python Ruby LuaTypeScriptRustGo Java C# C++ Kotlin Scala OCaml F# Clojure

Description#

Without an index this replaces every command bound to the name, leaving the one given at slot 0 — tmux assigns the array, not just an element. Pass at: to write one slot and leave its neighbours alone.

A name tmux does not know is a reply reporting why, not a thrown error.

  • Parameters:
    • name: a hook name tmux knows, such as after-new-window.
    • command: the tmux command line to run, unparsed until tmux runs it.
    • index: which slot to write, or every slot when omitted.
    • scope: which table to write to.
Parameters
Raises

tmux command#

The tmux commands behind setHook(_:to:at:in:).

tmux C API#

The C declarations in tmux that implement these commands.

tmux hooks#

Events that run tmux commands, with the scope each hook belongs to and where tmux fires it.

Guides#

Pages that discuss setHook(_:to:at:in:).

In other ports#

Bind a command to a global hook

Equivalents of Bind a command to a global hook in other languages
Language Equivalent
Python libtmux.Server.set_hook
Lua libtmux.Server:set_hook
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript server.Server.setHook
Rust server.Server.set_hook
Go no equivalent on Server
Java reached through Server.hooks, whose Hooks carries the write
C# reached through Server.Hooks, whose TmuxHooks carries the write
C++ no equivalent on Server
OCaml Libtmux_unix.Client.set_hook
Perl LibTmux::Server::set_hook Use global => true; command is an explicit native tmux command string.

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Bind a command to a session hook

Equivalents of Bind a command to a session hook in other languages
Language Equivalent
Python libtmux.Session.set_hook
Lua libtmux.Session:set_hook
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript session.Session.setHook
Rust session.Session.set_hook
Go tmux.Session.SetHook
Java reached through Session.hooks, whose Hooks carries the write
C# reached through Session.Hooks, whose TmuxHooks carries the write
C++ libtmux::Session::set_hook
OCaml Libtmux_unix.Client.set_hook
Perl LibTmux::Server::set_hook Use an explicit session target ID; command is an explicit native tmux command string.

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Bind a command to a window hook

Equivalents of Bind a command to a window hook in other languages
Language Equivalent
Python libtmux.Window.set_hook
Lua libtmux.Window:set_hook
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript window.Window.setHook
Rust window.Window.set_hook
Go tmux.Window.SetHook
Java reached through Window.hooks, whose Hooks carries the write
C# reached through Window.Hooks, whose TmuxHooks carries the write
C++ no equivalent on Window
OCaml Libtmux_unix.Client.set_hook
Perl No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands.

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Bind a command to a pane hook

Equivalents of Bind a command to a pane hook in other languages
Language Equivalent
Python libtmux.Pane.set_hook
Lua libtmux.Pane:set_hook
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript pane.Pane.setHook
Rust pane.Pane.set_hook
Go tmux.Pane.SetHook
Java reached through Pane.hooks, whose Hooks carries the write
C# reached through Pane.Hooks, whose TmuxHooks carries the write
C++ no equivalent on Pane
OCaml Libtmux_unix.Client.set_hook
Perl No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands.

No equivalent is recorded in Ruby, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference