| 1 |
"""Format variables for tmux objects. |
| 2 |
|
| 3 |
libtmux.formats |
| 4 |
~~~~~~~~~~~~~~~ |
| 5 |
|
| 6 |
:data:`FORMAT_SEPARATOR` is used at runtime by ``neo``, ``pane``, and |
| 7 |
``session``. The ``*_FORMATS`` lists (``SESSION_FORMATS``, |
| 8 |
``WINDOW_FORMATS``, ``PANE_FORMATS``, etc.) are **reference documentation |
| 9 |
only** — they are not imported or consumed at runtime. Runtime listings use |
| 10 |
:func:`libtmux.neo.get_output_format` to build tmux format strings for the |
| 11 |
active tmux version. |
| 12 |
|
| 13 |
For reference: https://github.com/tmux/tmux/blob/master/format.c |
| 14 |
|
| 15 |
""" |
| 16 |
|
| 17 |
from __future__ import annotations |
| 18 |
|
| 19 |
import os |
| 20 |
|
| 21 |
FORMAT_SEPARATOR = os.environ.get("LIBTMUX_TMUX_FORMAT_SEPARATOR", "␞") |
| 22 |
|
| 23 |
SESSION_FORMATS = [ |
| 24 |
"session_name", |
| 25 |
"session_windows", |
| 26 |
"session_width", |
| 27 |
"session_height", |
| 28 |
"session_id", |
| 29 |
"session_created", |
| 30 |
"session_created_string", |
| 31 |
"session_attached", |
| 32 |
|
| 33 |
"session_group", |
| 34 |
] |
| 35 |
|
| 36 |
CLIENT_FORMATS = [ |
| 37 |
"client_cwd", |
| 38 |
"client_height", |
| 39 |
"client_width", |
| 40 |
"client_tty", |
| 41 |
"client_termname", |
| 42 |
"client_created", |
| 43 |
"client_created_string", |
| 44 |
"client_activity", |
| 45 |
"client_activity_string", |
| 46 |
"client_prefix", |
| 47 |
"client_utf8", |
| 48 |
"client_readonly", |
| 49 |
"client_session", |
| 50 |
"client_last_session", |
| 51 |
] |
| 52 |
|
| 53 |
WINDOW_FORMATS = [ |
| 54 |
|
| 55 |
"window_id", |
| 56 |
"window_name", |
| 57 |
"window_width", |
| 58 |
"window_height", |
| 59 |
"window_layout", |
| 60 |
"window_panes", |
| 61 |
|
| 62 |
"window_index", |
| 63 |
"window_flags", |
| 64 |
"window_active", |
| 65 |
"window_bell_flag", |
| 66 |
"window_activity_flag", |
| 67 |
"window_silence_flag", |
| 68 |
] |
| 69 |
|
| 70 |
PANE_FORMATS = [ |
| 71 |
"history_size", |
| 72 |
"history_limit", |
| 73 |
"history_bytes", |
| 74 |
"pane_index", |
| 75 |
"pane_width", |
| 76 |
"pane_height", |
| 77 |
"pane_title", |
| 78 |
"pane_id", |
| 79 |
"pane_active", |
| 80 |
"pane_dead", |
| 81 |
"pane_in_mode", |
| 82 |
"pane_synchronized", |
| 83 |
"pane_tty", |
| 84 |
"pane_pid", |
| 85 |
"pane_start_command", |
| 86 |
"pane_start_path", |
| 87 |
"pane_current_path", |
| 88 |
"pane_current_command", |
| 89 |
"cursor_x", |
| 90 |
"cursor_y", |
| 91 |
"scroll_region_upper", |
| 92 |
"scroll_region_lower", |
| 93 |
"saved_cursor_x", |
| 94 |
"saved_cursor_y", |
| 95 |
"alternate_on", |
| 96 |
"alternate_saved_x", |
| 97 |
"alternate_saved_y", |
| 98 |
"cursor_flag", |
| 99 |
"insert_flag", |
| 100 |
"keypad_cursor_flag", |
| 101 |
"keypad_flag", |
| 102 |
"wrap_flag", |
| 103 |
"mouse_standard_flag", |
| 104 |
"mouse_button_flag", |
| 105 |
"mouse_any_flag", |
| 106 |
"mouse_utf8_flag", |
| 107 |
|
| 108 |
"pane_flags", |
| 109 |
"pane_floating_flag", |
| 110 |
"pane_x", |
| 111 |
"pane_y", |
| 112 |
"pane_z", |
| 113 |
"pane_zoomed_flag", |
| 114 |
"pane_pb_progress", |
| 115 |
"pane_pb_state", |
| 116 |
"pane_pipe_pid", |
| 117 |
"bracket_paste_flag", |
| 118 |
"synchronized_output_flag", |
| 119 |
] |