Skip to content

Add a typed list of tmux hooks (options-table.c) #161

Open

Description

@tony

Summary

Hooks takes the event name as a String, and libtmux holds no list of tmux's hooks. Which hooks exist, and which scope each belongs to, is known only to tmux.

Motivation

tmux rejects an unknown hook name with invalid option, but accepts a known hook set at a scope it does not belong to and then discards it. The Hooks Javadoc says so: pane-focus-in is a window hook, alert-bell is a session hook, and the wrong scope is "accepted and then silently discarded, on every supported release". A caller finds out when the hook never fires, because the library has no list to check the scope against.

The set of hooks grows by release. The tmux 3.8 CHANGES adds hooks for client create and destroy, pane activity, pane mode and prompt changes, pane movement and resizing, session group changes, and window creation, close, swap and zoom.

Sibling ports ship the list. libtmux-go generates hook definitions that carry each hook's scope and minimum tmux version, and libtmux-rs generates name constants for tmux's hooks.

tmux declares a hook as an option with the OPTIONS_TABLE_HOOK macro, and lists the hooks at the end of options_table[].

Proposal

A typed list of tmux hooks: each hook name the library knows.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions