Internal Constants - libtmux._internal.constants¶
Warning
Be careful with these! These constants are private, internal as they’re not covered by version policies. They can break or be removed between minor versions!
If you need a data structure here made public or stabilized please file an issue.
Internal constants.
- class libtmux._internal.constants.ServerOptions[source]¶
Bases:
SkipDefaultFieldsReprMixinServerOptions(**kwargs: ‘object’) -> ‘None’
-
command_alias:
SparseArray[str]¶
-
terminal_overrides:
SparseArray[str]¶
-
user_keys:
SparseArray[str]¶
-
command_alias:
- class libtmux._internal.constants.SessionOptions[source]¶
Bases:
SkipDefaultFieldsReprMixinSessionOptions(**kwargs: ‘object’) -> ‘None’
-
update_environment:
SparseArray[str]¶
-
update_environment:
- class libtmux._internal.constants.WindowOptions[source]¶
Bases:
SkipDefaultFieldsReprMixinWindowOptions(**kwargs: ‘object’) -> ‘None’
- class libtmux._internal.constants.PaneOptions[source]¶
Bases:
SkipDefaultFieldsReprMixinPaneOptions(**kwargs: ‘object’) -> ‘None’
- class libtmux._internal.constants.Options[source]¶
Bases:
ServerOptions,SessionOptions,WindowOptions,PaneOptions,SkipDefaultFieldsReprMixinOptions(**kwargs: ‘object’) -> ‘None’
-
cursor_style:
Optional[Literal['default','blinking-block','block','blinking-underline','underline','blinking-bar','bar']] = None¶
-
popup_border_lines:
Optional[Literal['single','rounded','double','heavy','simple','padded','none']] = None¶
-
command_alias:
SparseArray[str]¶
-
terminal_overrides:
SparseArray[str]¶
-
user_keys:
SparseArray[str]¶
-
update_environment:
SparseArray[str]¶
-
cursor_style:
- class libtmux._internal.constants.Hooks[source]¶
Bases:
SkipDefaultFieldsReprMixintmux hooks data structure.
Parses tmux hook output into typed
SparseArrayfields, preserving array indices for hooks that can have multiple commands at different indices.Examples
Parse raw tmux hook output:
>>> from libtmux._internal.constants import Hooks
>>> raw = [ ... "session-renamed[0] set-option -g status-left-style bg=red", ... "session-renamed[1] display-message 'session renamed'", ... ] >>> hooks = Hooks.from_stdout(raw)
Access individual hook commands by index:
>>> hooks.session_renamed[0] 'set-option -g status-left-style bg=red' >>> hooks.session_renamed[1] "display-message 'session renamed'"
Get all commands as a list (sorted by index):
>>> hooks.session_renamed.as_list() ['set-option -g status-left-style bg=red', "display-message 'session renamed'"]
Sparse indices are preserved (gaps in index numbers):
>>> raw_sparse = [ ... "pane-focus-in[0] refresh-client", ... "pane-focus-in[5] display-message 'focus'", ... ] >>> hooks_sparse = Hooks.from_stdout(raw_sparse) >>> 0 in hooks_sparse.pane_focus_in True >>> 5 in hooks_sparse.pane_focus_in True >>> 3 in hooks_sparse.pane_focus_in False >>> sorted(hooks_sparse.pane_focus_in.keys()) [0, 5]
Iterate over values in index order:
>>> for cmd in hooks_sparse.pane_focus_in.iter_values(): ... print(cmd) refresh-client display-message 'focus'
Multiple hook types in one parse:
>>> raw_multi = [ ... "after-new-window[0] select-pane -t 0", ... "after-new-window[1] send-keys 'clear' Enter", ... "window-renamed[0] refresh-client -S", ... ] >>> hooks_multi = Hooks.from_stdout(raw_multi) >>> len(hooks_multi.after_new_window) 2 >>> len(hooks_multi.window_renamed) 1
-
alert_activity:
SparseArray[str]¶
-
alert_bell:
SparseArray[str]¶
-
alert_silence:
SparseArray[str]¶
-
client_active:
SparseArray[str]¶
-
client_attached:
SparseArray[str]¶
-
client_detached:
SparseArray[str]¶
-
client_focus_in:
SparseArray[str]¶
-
client_focus_out:
SparseArray[str]¶
-
client_resized:
SparseArray[str]¶
-
client_session_changed:
SparseArray[str]¶
-
pane_died:
SparseArray[str]¶
-
pane_exited:
SparseArray[str]¶
-
pane_focus_in:
SparseArray[str]¶
-
pane_focus_out:
SparseArray[str]¶
-
pane_set_clipboard:
SparseArray[str]¶
-
session_created:
SparseArray[str]¶
-
session_closed:
SparseArray[str]¶
-
session_renamed:
SparseArray[str]¶
-
window_linked:
SparseArray[str]¶
-
window_renamed:
SparseArray[str]¶
-
window_resized:
SparseArray[str]¶
-
window_unlinked:
SparseArray[str]¶
-
pane_title_changed:
SparseArray[str]¶
-
client_light_theme:
SparseArray[str]¶
-
client_dark_theme:
SparseArray[str]¶
-
client_detached_control:
SparseArray[str]¶
-
client_session_changed_control:
SparseArray[str]¶
-
config_error:
SparseArray[str]¶
-
continue_control:
SparseArray[str]¶
-
exit_control:
SparseArray[str]¶
-
extended_output:
SparseArray[str]¶
-
layout_change:
SparseArray[str]¶
-
message_control:
SparseArray[str]¶
-
output:
SparseArray[str]¶
-
pane_mode_changed:
SparseArray[str]¶
-
paste_buffer_changed:
SparseArray[str]¶
-
paste_buffer_deleted:
SparseArray[str]¶
-
pause_control:
SparseArray[str]¶
-
session_changed_control:
SparseArray[str]¶
-
session_renamed_control:
SparseArray[str]¶
-
session_window_changed:
SparseArray[str]¶
-
sessions_changed:
SparseArray[str]¶
-
subscription_changed:
SparseArray[str]¶
-
unlinked_window_add:
SparseArray[str]¶
-
unlinked_window_close:
SparseArray[str]¶
-
unlinked_window_renamed:
SparseArray[str]¶
-
window_add:
SparseArray[str]¶
-
window_close:
SparseArray[str]¶
-
window_layout_changed:
SparseArray[str]¶
-
window_pane_changed:
SparseArray[str]¶
-
window_renamed_control:
SparseArray[str]¶
-
after_bind_key:
SparseArray[str]¶
-
after_capture_pane:
SparseArray[str]¶
-
after_copy_mode:
SparseArray[str]¶
-
after_display_message:
SparseArray[str]¶
-
after_display_panes:
SparseArray[str]¶
-
after_kill_pane:
SparseArray[str]¶
-
after_list_buffers:
SparseArray[str]¶
-
after_list_clients:
SparseArray[str]¶
-
after_list_keys:
SparseArray[str]¶
-
after_list_panes:
SparseArray[str]¶
-
after_list_sessions:
SparseArray[str]¶
-
after_list_windows:
SparseArray[str]¶
-
after_load_buffer:
SparseArray[str]¶
-
after_lock_server:
SparseArray[str]¶
-
after_new_session:
SparseArray[str]¶
-
after_new_window:
SparseArray[str]¶
-
after_paste_buffer:
SparseArray[str]¶
-
after_pipe_pane:
SparseArray[str]¶
-
after_queue:
SparseArray[str]¶
-
after_refresh_client:
SparseArray[str]¶
-
after_rename_session:
SparseArray[str]¶
-
after_rename_window:
SparseArray[str]¶
-
after_resize_pane:
SparseArray[str]¶
-
after_resize_window:
SparseArray[str]¶
-
after_save_buffer:
SparseArray[str]¶
-
after_select_layout:
SparseArray[str]¶
-
after_select_pane:
SparseArray[str]¶
-
after_select_window:
SparseArray[str]¶
-
after_send_keys:
SparseArray[str]¶
-
after_set_buffer:
SparseArray[str]¶
-
after_set_environment:
SparseArray[str]¶
-
after_set_hook:
SparseArray[str]¶
-
after_set_option:
SparseArray[str]¶
-
after_show_environment:
SparseArray[str]¶
-
after_show_messages:
SparseArray[str]¶
-
after_show_options:
SparseArray[str]¶
-
after_split_window:
SparseArray[str]¶
-
after_unbind_key:
SparseArray[str]¶
-
command_error:
SparseArray[str]¶
- classmethod from_stdout(value)[source]¶
Parse raw tmux hook output into a Hooks instance.
The parsing pipeline:
parse_options_to_dict()- Parse “key value” lines into dictexplode_arrays(force_array=True)- Extract array indices into SparseArrayexplode_complex()- Handle complex option typesRename keys:
session-renamed→session_renamed
- Parameters:
value (list[str]) – Raw tmux output lines from
show-hookscommand.- Returns:
Parsed hooks with SparseArray fields for each hook type.
- Return type:
Examples
Basic parsing:
>>> from libtmux._internal.constants import Hooks
>>> raw = ["session-renamed[0] display-message 'renamed'"] >>> hooks = Hooks.from_stdout(raw) >>> hooks.session_renamed[0] "display-message 'renamed'"
The pipeline preserves sparse indices:
>>> raw = [ ... "after-select-window[0] refresh-client", ... "after-select-window[10] display-message 'selected'", ... ] >>> hooks = Hooks.from_stdout(raw) >>> sorted(hooks.after_select_window.keys()) [0, 10]
Empty input returns empty SparseArrays:
>>> hooks_empty = Hooks.from_stdout([]) >>> len(hooks_empty.session_renamed) 0 >>> hooks_empty.session_renamed.as_list() []
- __init__(alert_activity=<factory>, alert_bell=<factory>, alert_silence=<factory>, client_active=<factory>, client_attached=<factory>, client_detached=<factory>, client_focus_in=<factory>, client_focus_out=<factory>, client_resized=<factory>, client_session_changed=<factory>, pane_died=<factory>, pane_exited=<factory>, pane_focus_in=<factory>, pane_focus_out=<factory>, pane_set_clipboard=<factory>, session_created=<factory>, session_closed=<factory>, session_renamed=<factory>, window_linked=<factory>, window_renamed=<factory>, window_resized=<factory>, window_unlinked=<factory>, pane_title_changed=<factory>, client_light_theme=<factory>, client_dark_theme=<factory>, client_detached_control=<factory>, client_session_changed_control=<factory>, config_error=<factory>, continue_control=<factory>, exit_control=<factory>, extended_output=<factory>, layout_change=<factory>, message_control=<factory>, output=<factory>, pane_mode_changed=<factory>, paste_buffer_changed=<factory>, paste_buffer_deleted=<factory>, pause_control=<factory>, session_changed_control=<factory>, session_renamed_control=<factory>, session_window_changed=<factory>, sessions_changed=<factory>, subscription_changed=<factory>, unlinked_window_add=<factory>, unlinked_window_close=<factory>, unlinked_window_renamed=<factory>, window_add=<factory>, window_close=<factory>, window_layout_changed=<factory>, window_pane_changed=<factory>, window_renamed_control=<factory>, after_bind_key=<factory>, after_capture_pane=<factory>, after_copy_mode=<factory>, after_display_message=<factory>, after_display_panes=<factory>, after_kill_pane=<factory>, after_list_buffers=<factory>, after_list_clients=<factory>, after_list_keys=<factory>, after_list_panes=<factory>, after_list_sessions=<factory>, after_list_windows=<factory>, after_load_buffer=<factory>, after_lock_server=<factory>, after_new_session=<factory>, after_new_window=<factory>, after_paste_buffer=<factory>, after_pipe_pane=<factory>, after_queue=<factory>, after_refresh_client=<factory>, after_rename_session=<factory>, after_rename_window=<factory>, after_resize_pane=<factory>, after_resize_window=<factory>, after_save_buffer=<factory>, after_select_layout=<factory>, after_select_pane=<factory>, after_select_window=<factory>, after_send_keys=<factory>, after_set_buffer=<factory>, after_set_environment=<factory>, after_set_hook=<factory>, after_set_option=<factory>, after_show_environment=<factory>, after_show_messages=<factory>, after_show_options=<factory>, after_split_window=<factory>, after_unbind_key=<factory>, command_error=<factory>)[source]¶
- Parameters:
alert_activity (SparseArray[str])
alert_bell (SparseArray[str])
alert_silence (SparseArray[str])
client_active (SparseArray[str])
client_attached (SparseArray[str])
client_detached (SparseArray[str])
client_focus_in (SparseArray[str])
client_focus_out (SparseArray[str])
client_resized (SparseArray[str])
client_session_changed (SparseArray[str])
pane_died (SparseArray[str])
pane_exited (SparseArray[str])
pane_focus_in (SparseArray[str])
pane_focus_out (SparseArray[str])
pane_set_clipboard (SparseArray[str])
session_created (SparseArray[str])
session_closed (SparseArray[str])
session_renamed (SparseArray[str])
window_linked (SparseArray[str])
window_renamed (SparseArray[str])
window_resized (SparseArray[str])
window_unlinked (SparseArray[str])
pane_title_changed (SparseArray[str])
client_light_theme (SparseArray[str])
client_dark_theme (SparseArray[str])
client_detached_control (SparseArray[str])
client_session_changed_control (SparseArray[str])
config_error (SparseArray[str])
continue_control (SparseArray[str])
exit_control (SparseArray[str])
extended_output (SparseArray[str])
layout_change (SparseArray[str])
message_control (SparseArray[str])
output (SparseArray[str])
pane_mode_changed (SparseArray[str])
paste_buffer_changed (SparseArray[str])
paste_buffer_deleted (SparseArray[str])
pause_control (SparseArray[str])
session_changed_control (SparseArray[str])
session_renamed_control (SparseArray[str])
session_window_changed (SparseArray[str])
sessions_changed (SparseArray[str])
subscription_changed (SparseArray[str])
unlinked_window_add (SparseArray[str])
unlinked_window_close (SparseArray[str])
unlinked_window_renamed (SparseArray[str])
window_add (SparseArray[str])
window_close (SparseArray[str])
window_layout_changed (SparseArray[str])
window_pane_changed (SparseArray[str])
window_renamed_control (SparseArray[str])
after_bind_key (SparseArray[str])
after_capture_pane (SparseArray[str])
after_copy_mode (SparseArray[str])
after_display_message (SparseArray[str])
after_display_panes (SparseArray[str])
after_kill_pane (SparseArray[str])
after_list_buffers (SparseArray[str])
after_list_clients (SparseArray[str])
after_list_keys (SparseArray[str])
after_list_panes (SparseArray[str])
after_list_sessions (SparseArray[str])
after_list_windows (SparseArray[str])
after_load_buffer (SparseArray[str])
after_lock_server (SparseArray[str])
after_new_session (SparseArray[str])
after_new_window (SparseArray[str])
after_paste_buffer (SparseArray[str])
after_pipe_pane (SparseArray[str])
after_queue (SparseArray[str])
after_refresh_client (SparseArray[str])
after_rename_session (SparseArray[str])
after_rename_window (SparseArray[str])
after_resize_pane (SparseArray[str])
after_resize_window (SparseArray[str])
after_save_buffer (SparseArray[str])
after_select_layout (SparseArray[str])
after_select_pane (SparseArray[str])
after_select_window (SparseArray[str])
after_send_keys (SparseArray[str])
after_set_buffer (SparseArray[str])
after_set_environment (SparseArray[str])
after_set_hook (SparseArray[str])
after_set_option (SparseArray[str])
after_show_environment (SparseArray[str])
after_show_messages (SparseArray[str])
after_show_options (SparseArray[str])
after_split_window (SparseArray[str])
after_unbind_key (SparseArray[str])
command_error (SparseArray[str])
- Return type:
None
-
alert_activity: