Do not try to strdup NULL, from seL4 at disroot dot org in GitHub issue
[tmux-openbsd.git] / options-table.c
blobcfb8162eb9a2abc21c0c6e01a7e95a975f4b9b78
1 /* $OpenBSD$ */
3 /*
4 * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include <sys/types.h>
21 #include <string.h>
22 #include <paths.h>
24 #include "tmux.h"
27 * This file has a tables with all the server, session and window
28 * options. These tables are the master copy of the options with their real
29 * (user-visible) types, range limits and default values. At start these are
30 * copied into the runtime global options trees (which only has number and
31 * string types). These tables are then used to look up the real type when the
32 * user sets an option or its value needs to be shown.
35 /* Choice option type lists. */
36 static const char *options_table_mode_keys_list[] = {
37 "emacs", "vi", NULL
39 static const char *options_table_clock_mode_style_list[] = {
40 "12", "24", NULL
42 static const char *options_table_status_list[] = {
43 "off", "on", "2", "3", "4", "5", NULL
45 static const char *options_table_status_keys_list[] = {
46 "emacs", "vi", NULL
48 static const char *options_table_status_justify_list[] = {
49 "left", "centre", "right", "absolute-centre", NULL
51 static const char *options_table_status_position_list[] = {
52 "top", "bottom", NULL
54 static const char *options_table_bell_action_list[] = {
55 "none", "any", "current", "other", NULL
57 static const char *options_table_visual_bell_list[] = {
58 "off", "on", "both", NULL
60 static const char *options_table_cursor_style_list[] = {
61 "default", "blinking-block", "block", "blinking-underline", "underline",
62 "blinking-bar", "bar", NULL
64 static const char *options_table_pane_status_list[] = {
65 "off", "top", "bottom", NULL
67 static const char *options_table_pane_border_lines_list[] = {
68 "single", "double", "heavy", "simple", "number", NULL
70 static const char *options_table_popup_border_lines_list[] = {
71 "single", "double", "heavy", "simple", "rounded", "padded", "none", NULL
73 static const char *options_table_set_clipboard_list[] = {
74 "off", "external", "on", NULL
76 static const char *options_table_window_size_list[] = {
77 "largest", "smallest", "manual", "latest", NULL
79 static const char *options_table_remain_on_exit_list[] = {
80 "off", "on", "failed", NULL
82 static const char *options_table_detach_on_destroy_list[] = {
83 "off", "on", "no-detached", NULL
85 static const char *options_table_extended_keys_list[] = {
86 "off", "on", "always", NULL
89 /* Status line format. */
90 #define OPTIONS_TABLE_STATUS_FORMAT1 \
91 "#[align=left range=left #{E:status-left-style}]" \
92 "#[push-default]" \
93 "#{T;=/#{status-left-length}:status-left}" \
94 "#[pop-default]" \
95 "#[norange default]" \
96 "#[list=on align=#{status-justify}]" \
97 "#[list=left-marker]<#[list=right-marker]>#[list=on]" \
98 "#{W:" \
99 "#[range=window|#{window_index} " \
100 "#{E:window-status-style}" \
101 "#{?#{&&:#{window_last_flag}," \
102 "#{!=:#{E:window-status-last-style},default}}, " \
103 "#{E:window-status-last-style}," \
104 "}" \
105 "#{?#{&&:#{window_bell_flag}," \
106 "#{!=:#{E:window-status-bell-style},default}}, " \
107 "#{E:window-status-bell-style}," \
108 "#{?#{&&:#{||:#{window_activity_flag}," \
109 "#{window_silence_flag}}," \
110 "#{!=:" \
111 "#{E:window-status-activity-style}," \
112 "default}}, " \
113 "#{E:window-status-activity-style}," \
114 "}" \
115 "}" \
116 "]" \
117 "#[push-default]" \
118 "#{T:window-status-format}" \
119 "#[pop-default]" \
120 "#[norange default]" \
121 "#{?window_end_flag,,#{window-status-separator}}" \
122 "," \
123 "#[range=window|#{window_index} list=focus " \
124 "#{?#{!=:#{E:window-status-current-style},default}," \
125 "#{E:window-status-current-style}," \
126 "#{E:window-status-style}" \
127 "}" \
128 "#{?#{&&:#{window_last_flag}," \
129 "#{!=:#{E:window-status-last-style},default}}, " \
130 "#{E:window-status-last-style}," \
131 "}" \
132 "#{?#{&&:#{window_bell_flag}," \
133 "#{!=:#{E:window-status-bell-style},default}}, " \
134 "#{E:window-status-bell-style}," \
135 "#{?#{&&:#{||:#{window_activity_flag}," \
136 "#{window_silence_flag}}," \
137 "#{!=:" \
138 "#{E:window-status-activity-style}," \
139 "default}}, " \
140 "#{E:window-status-activity-style}," \
141 "}" \
142 "}" \
143 "]" \
144 "#[push-default]" \
145 "#{T:window-status-current-format}" \
146 "#[pop-default]" \
147 "#[norange list=on default]" \
148 "#{?window_end_flag,,#{window-status-separator}}" \
149 "}" \
150 "#[nolist align=right range=right #{E:status-right-style}]" \
151 "#[push-default]" \
152 "#{T;=/#{status-right-length}:status-right}" \
153 "#[pop-default]" \
154 "#[norange default]"
155 #define OPTIONS_TABLE_STATUS_FORMAT2 \
156 "#[align=centre]#{P:#{?pane_active,#[reverse],}" \
157 "#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
158 static const char *options_table_status_format_default[] = {
159 OPTIONS_TABLE_STATUS_FORMAT1, OPTIONS_TABLE_STATUS_FORMAT2, NULL
162 /* Helpers for hook options. */
163 #define OPTIONS_TABLE_HOOK(hook_name, default_value) \
164 { .name = hook_name, \
165 .type = OPTIONS_TABLE_COMMAND, \
166 .scope = OPTIONS_TABLE_SESSION, \
167 .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
168 .default_str = default_value, \
169 .separator = "" \
172 #define OPTIONS_TABLE_PANE_HOOK(hook_name, default_value) \
173 { .name = hook_name, \
174 .type = OPTIONS_TABLE_COMMAND, \
175 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, \
176 .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
177 .default_str = default_value, \
178 .separator = "" \
181 #define OPTIONS_TABLE_WINDOW_HOOK(hook_name, default_value) \
182 { .name = hook_name, \
183 .type = OPTIONS_TABLE_COMMAND, \
184 .scope = OPTIONS_TABLE_WINDOW, \
185 .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
186 .default_str = default_value, \
187 .separator = "" \
190 /* Map of name conversions. */
191 const struct options_name_map options_other_names[] = {
192 { "display-panes-color", "display-panes-colour" },
193 { "display-panes-active-color", "display-panes-active-colour" },
194 { "clock-mode-color", "clock-mode-colour" },
195 { "cursor-color", "cursor-colour" },
196 { "pane-colors", "pane-colours" },
197 { NULL, NULL }
200 /* Top-level options. */
201 const struct options_table_entry options_table[] = {
202 /* Server options. */
203 { .name = "backspace",
204 .type = OPTIONS_TABLE_KEY,
205 .scope = OPTIONS_TABLE_SERVER,
206 .default_num = '\177',
207 .text = "The key to send for backspace."
210 { .name = "buffer-limit",
211 .type = OPTIONS_TABLE_NUMBER,
212 .scope = OPTIONS_TABLE_SERVER,
213 .minimum = 1,
214 .maximum = INT_MAX,
215 .default_num = 50,
216 .text = "The maximum number of automatic buffers. "
217 "When this is reached, the oldest buffer is deleted."
220 { .name = "command-alias",
221 .type = OPTIONS_TABLE_STRING,
222 .scope = OPTIONS_TABLE_SERVER,
223 .flags = OPTIONS_TABLE_IS_ARRAY,
224 .default_str = "split-pane=split-window,"
225 "splitp=split-window,"
226 "server-info=show-messages -JT,"
227 "info=show-messages -JT,"
228 "choose-window=choose-tree -w,"
229 "choose-session=choose-tree -s",
230 .separator = ",",
231 .text = "Array of command aliases. "
232 "Each entry is an alias and a command separated by '='."
235 { .name = "copy-command",
236 .type = OPTIONS_TABLE_STRING,
237 .scope = OPTIONS_TABLE_SERVER,
238 .default_str = "",
239 .text = "Shell command run when text is copied. "
240 "If empty, no command is run."
243 { .name = "cursor-colour",
244 .type = OPTIONS_TABLE_COLOUR,
245 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
246 .default_num = -1,
247 .text = "Colour of the cursor."
250 { .name = "cursor-style",
251 .type = OPTIONS_TABLE_CHOICE,
252 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
253 .choices = options_table_cursor_style_list,
254 .default_num = 0,
255 .text = "Style of the cursor."
258 { .name = "default-terminal",
259 .type = OPTIONS_TABLE_STRING,
260 .scope = OPTIONS_TABLE_SERVER,
261 .default_str = TMUX_TERM,
262 .text = "Default for the 'TERM' environment variable."
265 { .name = "editor",
266 .type = OPTIONS_TABLE_STRING,
267 .scope = OPTIONS_TABLE_SERVER,
268 .default_str = _PATH_VI,
269 .text = "Editor run to edit files."
272 { .name = "escape-time",
273 .type = OPTIONS_TABLE_NUMBER,
274 .scope = OPTIONS_TABLE_SERVER,
275 .minimum = 0,
276 .maximum = INT_MAX,
277 .default_num = 500,
278 .text = "Time to wait before assuming a key is Escape."
281 { .name = "exit-empty",
282 .type = OPTIONS_TABLE_FLAG,
283 .scope = OPTIONS_TABLE_SERVER,
284 .default_num = 1,
285 .text = "Whether the server should exit if there are no sessions."
288 { .name = "exit-unattached",
289 .type = OPTIONS_TABLE_FLAG,
290 .scope = OPTIONS_TABLE_SERVER,
291 .default_num = 0,
292 .text = "Whether the server should exit if there are no attached "
293 "clients."
296 { .name = "extended-keys",
297 .type = OPTIONS_TABLE_CHOICE,
298 .scope = OPTIONS_TABLE_SERVER,
299 .choices = options_table_extended_keys_list,
300 .default_num = 0,
301 .text = "Whether to request extended key sequences from terminals "
302 "that support it."
305 { .name = "focus-events",
306 .type = OPTIONS_TABLE_FLAG,
307 .scope = OPTIONS_TABLE_SERVER,
308 .default_num = 0,
309 .text = "Whether to send focus events to applications."
312 { .name = "history-file",
313 .type = OPTIONS_TABLE_STRING,
314 .scope = OPTIONS_TABLE_SERVER,
315 .default_str = "",
316 .text = "Location of the command prompt history file. "
317 "Empty does not write a history file."
320 { .name = "message-limit",
321 .type = OPTIONS_TABLE_NUMBER,
322 .scope = OPTIONS_TABLE_SERVER,
323 .minimum = 0,
324 .maximum = INT_MAX,
325 .default_num = 1000,
326 .text = "Maximum number of server messages to keep."
329 { .name = "prompt-history-limit",
330 .type = OPTIONS_TABLE_NUMBER,
331 .scope = OPTIONS_TABLE_SERVER,
332 .minimum = 0,
333 .maximum = INT_MAX,
334 .default_num = 100,
335 .text = "Maximum number of commands to keep in history."
338 { .name = "set-clipboard",
339 .type = OPTIONS_TABLE_CHOICE,
340 .scope = OPTIONS_TABLE_SERVER,
341 .choices = options_table_set_clipboard_list,
342 .default_num = 1,
343 .text = "Whether to attempt to set the system clipboard ('on' or "
344 "'external') and whether to allow applications to create "
345 "paste buffers with an escape sequence ('on' only)."
348 { .name = "terminal-overrides",
349 .type = OPTIONS_TABLE_STRING,
350 .scope = OPTIONS_TABLE_SERVER,
351 .flags = OPTIONS_TABLE_IS_ARRAY,
352 .default_str = "",
353 .separator = ",",
354 .text = "List of terminal capabilities overrides."
357 { .name = "terminal-features",
358 .type = OPTIONS_TABLE_STRING,
359 .scope = OPTIONS_TABLE_SERVER,
360 .flags = OPTIONS_TABLE_IS_ARRAY,
361 .default_str = "xterm*:clipboard:ccolour:cstyle:focus:title,"
362 "screen*:title",
363 .separator = ",",
364 .text = "List of terminal features, used if they cannot be "
365 "automatically detected."
368 { .name = "user-keys",
369 .type = OPTIONS_TABLE_STRING,
370 .scope = OPTIONS_TABLE_SERVER,
371 .flags = OPTIONS_TABLE_IS_ARRAY,
372 .default_str = "",
373 .separator = ",",
374 .text = "User key assignments. "
375 "Each sequence in the list is translated into a key: "
376 "'User0', 'User1' and so on."
379 /* Session options. */
380 { .name = "activity-action",
381 .type = OPTIONS_TABLE_CHOICE,
382 .scope = OPTIONS_TABLE_SESSION,
383 .choices = options_table_bell_action_list,
384 .default_num = ALERT_OTHER,
385 .text = "Action to take on an activity alert."
388 { .name = "assume-paste-time",
389 .type = OPTIONS_TABLE_NUMBER,
390 .scope = OPTIONS_TABLE_SESSION,
391 .minimum = 0,
392 .maximum = INT_MAX,
393 .default_num = 1,
394 .unit = "milliseconds",
395 .text = "Maximum time between input to assume it is pasting rather "
396 "than typing."
399 { .name = "base-index",
400 .type = OPTIONS_TABLE_NUMBER,
401 .scope = OPTIONS_TABLE_SESSION,
402 .minimum = 0,
403 .maximum = INT_MAX,
404 .default_num = 0,
405 .text = "Default index of the first window in each session."
408 { .name = "bell-action",
409 .type = OPTIONS_TABLE_CHOICE,
410 .scope = OPTIONS_TABLE_SESSION,
411 .choices = options_table_bell_action_list,
412 .default_num = ALERT_ANY,
413 .text = "Action to take on a bell alert."
416 { .name = "default-command",
417 .type = OPTIONS_TABLE_STRING,
418 .scope = OPTIONS_TABLE_SESSION,
419 .default_str = "",
420 .text = "Default command to run in new panes. If empty, a shell is "
421 "started."
424 { .name = "default-shell",
425 .type = OPTIONS_TABLE_STRING,
426 .scope = OPTIONS_TABLE_SESSION,
427 .default_str = _PATH_BSHELL,
428 .text = "Location of default shell."
431 { .name = "default-size",
432 .type = OPTIONS_TABLE_STRING,
433 .scope = OPTIONS_TABLE_SESSION,
434 .pattern = "[0-9]*x[0-9]*",
435 .default_str = "80x24",
436 .text = "Initial size of new sessions."
439 { .name = "destroy-unattached",
440 .type = OPTIONS_TABLE_FLAG,
441 .scope = OPTIONS_TABLE_SESSION,
442 .default_num = 0,
443 .text = "Whether to destroy sessions when they have no attached "
444 "clients."
447 { .name = "detach-on-destroy",
448 .type = OPTIONS_TABLE_CHOICE,
449 .scope = OPTIONS_TABLE_SESSION,
450 .choices = options_table_detach_on_destroy_list,
451 .default_num = 1,
452 .text = "Whether to detach when a session is destroyed, or switch "
453 "the client to another session if any exist."
456 { .name = "display-panes-active-colour",
457 .type = OPTIONS_TABLE_COLOUR,
458 .scope = OPTIONS_TABLE_SESSION,
459 .default_num = 1,
460 .text = "Colour of the active pane for 'display-panes'."
463 { .name = "display-panes-colour",
464 .type = OPTIONS_TABLE_COLOUR,
465 .scope = OPTIONS_TABLE_SESSION,
466 .default_num = 4,
467 .text = "Colour of not active panes for 'display-panes'."
470 { .name = "display-panes-time",
471 .type = OPTIONS_TABLE_NUMBER,
472 .scope = OPTIONS_TABLE_SESSION,
473 .minimum = 1,
474 .maximum = INT_MAX,
475 .default_num = 1000,
476 .unit = "milliseconds",
477 .text = "Time for which 'display-panes' should show pane numbers."
480 { .name = "display-time",
481 .type = OPTIONS_TABLE_NUMBER,
482 .scope = OPTIONS_TABLE_SESSION,
483 .minimum = 0,
484 .maximum = INT_MAX,
485 .default_num = 750,
486 .unit = "milliseconds",
487 .text = "Time for which status line messages should appear."
490 { .name = "history-limit",
491 .type = OPTIONS_TABLE_NUMBER,
492 .scope = OPTIONS_TABLE_SESSION,
493 .minimum = 0,
494 .maximum = INT_MAX,
495 .default_num = 2000,
496 .unit = "lines",
497 .text = "Maximum number of lines to keep in the history for each "
498 "pane. "
499 "If changed, the new value applies only to new panes."
502 { .name = "key-table",
503 .type = OPTIONS_TABLE_STRING,
504 .scope = OPTIONS_TABLE_SESSION,
505 .default_str = "root",
506 .text = "Default key table. "
507 "Key presses are first looked up in this table."
510 { .name = "lock-after-time",
511 .type = OPTIONS_TABLE_NUMBER,
512 .scope = OPTIONS_TABLE_SESSION,
513 .minimum = 0,
514 .maximum = INT_MAX,
515 .default_num = 0,
516 .unit = "seconds",
517 .text = "Time after which a client is locked if not used."
520 { .name = "lock-command",
521 .type = OPTIONS_TABLE_STRING,
522 .scope = OPTIONS_TABLE_SESSION,
523 .default_str = "lock -np",
524 .text = "Shell command to run to lock a client."
527 { .name = "message-command-style",
528 .type = OPTIONS_TABLE_STRING,
529 .scope = OPTIONS_TABLE_SESSION,
530 .default_str = "bg=black,fg=yellow",
531 .flags = OPTIONS_TABLE_IS_STYLE,
532 .separator = ",",
533 .text = "Style of the command prompt when in command mode, if "
534 "'mode-keys' is set to 'vi'."
537 { .name = "message-style",
538 .type = OPTIONS_TABLE_STRING,
539 .scope = OPTIONS_TABLE_SESSION,
540 .default_str = "bg=yellow,fg=black",
541 .flags = OPTIONS_TABLE_IS_STYLE,
542 .separator = ",",
543 .text = "Style of the command prompt."
546 { .name = "mouse",
547 .type = OPTIONS_TABLE_FLAG,
548 .scope = OPTIONS_TABLE_SESSION,
549 .default_num = 0,
550 .text = "Whether the mouse is recognised and mouse key bindings are "
551 "executed. "
552 "Applications inside panes can use the mouse even when 'off'."
555 { .name = "prefix",
556 .type = OPTIONS_TABLE_KEY,
557 .scope = OPTIONS_TABLE_SESSION,
558 .default_num = '\002',
559 .text = "The prefix key."
562 { .name = "prefix2",
563 .type = OPTIONS_TABLE_KEY,
564 .scope = OPTIONS_TABLE_SESSION,
565 .default_num = KEYC_NONE,
566 .text = "A second prefix key."
569 { .name = "renumber-windows",
570 .type = OPTIONS_TABLE_FLAG,
571 .scope = OPTIONS_TABLE_SESSION,
572 .default_num = 0,
573 .text = "Whether windows are automatically renumbered rather than "
574 "leaving gaps."
577 { .name = "repeat-time",
578 .type = OPTIONS_TABLE_NUMBER,
579 .scope = OPTIONS_TABLE_SESSION,
580 .minimum = 0,
581 .maximum = SHRT_MAX,
582 .default_num = 500,
583 .unit = "milliseconds",
584 .text = "Time to wait for a key binding to repeat, if it is bound "
585 "with the '-r' flag."
588 { .name = "set-titles",
589 .type = OPTIONS_TABLE_FLAG,
590 .scope = OPTIONS_TABLE_SESSION,
591 .default_num = 0,
592 .text = "Whether to set the terminal title, if supported."
595 { .name = "set-titles-string",
596 .type = OPTIONS_TABLE_STRING,
597 .scope = OPTIONS_TABLE_SESSION,
598 .default_str = "#S:#I:#W - \"#T\" #{session_alerts}",
599 .text = "Format of the terminal title to set."
602 { .name = "silence-action",
603 .type = OPTIONS_TABLE_CHOICE,
604 .scope = OPTIONS_TABLE_SESSION,
605 .choices = options_table_bell_action_list,
606 .default_num = ALERT_OTHER,
607 .text = "Action to take on a silence alert."
610 { .name = "status",
611 .type = OPTIONS_TABLE_CHOICE,
612 .scope = OPTIONS_TABLE_SESSION,
613 .choices = options_table_status_list,
614 .default_num = 1,
615 .text = "Number of lines in the status line."
618 { .name = "status-bg",
619 .type = OPTIONS_TABLE_COLOUR,
620 .scope = OPTIONS_TABLE_SESSION,
621 .default_num = 8,
622 .text = "Background colour of the status line. This option is "
623 "deprecated, use 'status-style' instead."
626 { .name = "status-fg",
627 .type = OPTIONS_TABLE_COLOUR,
628 .scope = OPTIONS_TABLE_SESSION,
629 .default_num = 8,
630 .text = "Foreground colour of the status line. This option is "
631 "deprecated, use 'status-style' instead."
634 { .name = "status-format",
635 .type = OPTIONS_TABLE_STRING,
636 .scope = OPTIONS_TABLE_SESSION,
637 .flags = OPTIONS_TABLE_IS_ARRAY,
638 .default_arr = options_table_status_format_default,
639 .text = "Formats for the status lines. "
640 "Each array member is the format for one status line. "
641 "The default status line is made up of several components "
642 "which may be configured individually with other options such "
643 "as 'status-left'."
646 { .name = "status-interval",
647 .type = OPTIONS_TABLE_NUMBER,
648 .scope = OPTIONS_TABLE_SESSION,
649 .minimum = 0,
650 .maximum = INT_MAX,
651 .default_num = 15,
652 .unit = "seconds",
653 .text = "Number of seconds between status line updates."
656 { .name = "status-justify",
657 .type = OPTIONS_TABLE_CHOICE,
658 .scope = OPTIONS_TABLE_SESSION,
659 .choices = options_table_status_justify_list,
660 .default_num = 0,
661 .text = "Position of the window list in the status line."
664 { .name = "status-keys",
665 .type = OPTIONS_TABLE_CHOICE,
666 .scope = OPTIONS_TABLE_SESSION,
667 .choices = options_table_status_keys_list,
668 .default_num = MODEKEY_EMACS,
669 .text = "Key set to use at the command prompt."
672 { .name = "status-left",
673 .type = OPTIONS_TABLE_STRING,
674 .scope = OPTIONS_TABLE_SESSION,
675 .default_str = "[#{session_name}] ",
676 .text = "Contents of the left side of the status line."
679 { .name = "status-left-length",
680 .type = OPTIONS_TABLE_NUMBER,
681 .scope = OPTIONS_TABLE_SESSION,
682 .minimum = 0,
683 .maximum = SHRT_MAX,
684 .default_num = 10,
685 .text = "Maximum width of the left side of the status line."
688 { .name = "status-left-style",
689 .type = OPTIONS_TABLE_STRING,
690 .scope = OPTIONS_TABLE_SESSION,
691 .default_str = "default",
692 .flags = OPTIONS_TABLE_IS_STYLE,
693 .separator = ",",
694 .text = "Style of the left side of the status line."
697 { .name = "status-position",
698 .type = OPTIONS_TABLE_CHOICE,
699 .scope = OPTIONS_TABLE_SESSION,
700 .choices = options_table_status_position_list,
701 .default_num = 1,
702 .text = "Position of the status line."
705 { .name = "status-right",
706 .type = OPTIONS_TABLE_STRING,
707 .scope = OPTIONS_TABLE_SESSION,
708 .default_str = "#{?window_bigger,"
709 "[#{window_offset_x}#,#{window_offset_y}] ,}"
710 "\"#{=21:pane_title}\" %H:%M %d-%b-%y",
711 .text = "Contents of the right side of the status line."
715 { .name = "status-right-length",
716 .type = OPTIONS_TABLE_NUMBER,
717 .scope = OPTIONS_TABLE_SESSION,
718 .minimum = 0,
719 .maximum = SHRT_MAX,
720 .default_num = 40,
721 .text = "Maximum width of the right side of the status line."
724 { .name = "status-right-style",
725 .type = OPTIONS_TABLE_STRING,
726 .scope = OPTIONS_TABLE_SESSION,
727 .default_str = "default",
728 .flags = OPTIONS_TABLE_IS_STYLE,
729 .separator = ",",
730 .text = "Style of the right side of the status line."
733 { .name = "status-style",
734 .type = OPTIONS_TABLE_STRING,
735 .scope = OPTIONS_TABLE_SESSION,
736 .default_str = "bg=green,fg=black",
737 .flags = OPTIONS_TABLE_IS_STYLE,
738 .separator = ",",
739 .text = "Style of the status line."
742 { .name = "update-environment",
743 .type = OPTIONS_TABLE_STRING,
744 .scope = OPTIONS_TABLE_SESSION,
745 .flags = OPTIONS_TABLE_IS_ARRAY,
746 .default_str = "DISPLAY KRB5CCNAME SSH_ASKPASS SSH_AUTH_SOCK "
747 "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY",
748 .text = "List of environment variables to update in the session "
749 "environment when a client is attached."
752 { .name = "visual-activity",
753 .type = OPTIONS_TABLE_CHOICE,
754 .scope = OPTIONS_TABLE_SESSION,
755 .choices = options_table_visual_bell_list,
756 .default_num = VISUAL_OFF,
757 .text = "How activity alerts should be shown: a message ('on'), "
758 "a message and a bell ('both') or nothing ('off')."
761 { .name = "visual-bell",
762 .type = OPTIONS_TABLE_CHOICE,
763 .scope = OPTIONS_TABLE_SESSION,
764 .choices = options_table_visual_bell_list,
765 .default_num = VISUAL_OFF,
766 .text = "How bell alerts should be shown: a message ('on'), "
767 "a message and a bell ('both') or nothing ('off')."
770 { .name = "visual-silence",
771 .type = OPTIONS_TABLE_CHOICE,
772 .scope = OPTIONS_TABLE_SESSION,
773 .choices = options_table_visual_bell_list,
774 .default_num = VISUAL_OFF,
775 .text = "How silence alerts should be shown: a message ('on'), "
776 "a message and a bell ('both') or nothing ('off')."
779 { .name = "word-separators",
780 .type = OPTIONS_TABLE_STRING,
781 .scope = OPTIONS_TABLE_SESSION,
783 * The set of non-alphanumeric printable ASCII characters minus the
784 * underscore.
786 .default_str = "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~",
787 .text = "Characters considered to separate words."
790 /* Window options. */
791 { .name = "aggressive-resize",
792 .type = OPTIONS_TABLE_FLAG,
793 .scope = OPTIONS_TABLE_WINDOW,
794 .default_num = 0,
795 .text = "When 'window-size' is 'smallest', whether the maximum size "
796 "of a window is the smallest attached session where it is "
797 "the current window ('on') or the smallest session it is "
798 "linked to ('off')."
801 { .name = "allow-rename",
802 .type = OPTIONS_TABLE_FLAG,
803 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
804 .default_num = 0,
805 .text = "Whether applications are allowed to use the escape sequence "
806 "to rename windows."
809 { .name = "alternate-screen",
810 .type = OPTIONS_TABLE_FLAG,
811 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
812 .default_num = 1,
813 .text = "Whether applications are allowed to use the alternate "
814 "screen."
817 { .name = "automatic-rename",
818 .type = OPTIONS_TABLE_FLAG,
819 .scope = OPTIONS_TABLE_WINDOW,
820 .default_num = 1,
821 .text = "Whether windows are automatically renamed."
824 { .name = "automatic-rename-format",
825 .type = OPTIONS_TABLE_STRING,
826 .scope = OPTIONS_TABLE_WINDOW,
827 .default_str = "#{?pane_in_mode,[tmux],#{pane_current_command}}"
828 "#{?pane_dead,[dead],}",
829 .text = "Format used to automatically rename windows."
832 { .name = "clock-mode-colour",
833 .type = OPTIONS_TABLE_COLOUR,
834 .scope = OPTIONS_TABLE_WINDOW,
835 .default_num = 4,
836 .text = "Colour of the clock in clock mode."
839 { .name = "clock-mode-style",
840 .type = OPTIONS_TABLE_CHOICE,
841 .scope = OPTIONS_TABLE_WINDOW,
842 .choices = options_table_clock_mode_style_list,
843 .default_num = 1,
844 .text = "Time format of the clock in clock mode."
847 { .name = "copy-mode-match-style",
848 .type = OPTIONS_TABLE_STRING,
849 .scope = OPTIONS_TABLE_WINDOW,
850 .default_str = "bg=cyan,fg=black",
851 .flags = OPTIONS_TABLE_IS_STYLE,
852 .separator = ",",
853 .text = "Style of search matches in copy mode."
856 { .name = "copy-mode-current-match-style",
857 .type = OPTIONS_TABLE_STRING,
858 .scope = OPTIONS_TABLE_WINDOW,
859 .default_str = "bg=magenta,fg=black",
860 .flags = OPTIONS_TABLE_IS_STYLE,
861 .separator = ",",
862 .text = "Style of the current search match in copy mode."
865 { .name = "copy-mode-mark-style",
866 .type = OPTIONS_TABLE_STRING,
867 .scope = OPTIONS_TABLE_WINDOW,
868 .default_str = "bg=red,fg=black",
869 .flags = OPTIONS_TABLE_IS_STYLE,
870 .separator = ",",
871 .text = "Style of the marked line in copy mode."
874 { .name = "main-pane-height",
875 .type = OPTIONS_TABLE_STRING,
876 .scope = OPTIONS_TABLE_WINDOW,
877 .default_str = "24",
878 .text = "Height of the main pane in the 'main-horizontal' layout. "
879 "This may be a percentage, for example '10%'."
882 { .name = "main-pane-width",
883 .type = OPTIONS_TABLE_STRING,
884 .scope = OPTIONS_TABLE_WINDOW,
885 .default_str = "80",
886 .text = "Width of the main pane in the 'main-vertical' layout. "
887 "This may be a percentage, for example '10%'."
890 { .name = "mode-keys",
891 .type = OPTIONS_TABLE_CHOICE,
892 .scope = OPTIONS_TABLE_WINDOW,
893 .choices = options_table_mode_keys_list,
894 .default_num = MODEKEY_EMACS,
895 .text = "Key set used in copy mode."
898 { .name = "mode-style",
899 .type = OPTIONS_TABLE_STRING,
900 .scope = OPTIONS_TABLE_WINDOW,
901 .default_str = "bg=yellow,fg=black",
902 .flags = OPTIONS_TABLE_IS_STYLE,
903 .separator = ",",
904 .text = "Style of indicators and highlighting in modes."
907 { .name = "monitor-activity",
908 .type = OPTIONS_TABLE_FLAG,
909 .scope = OPTIONS_TABLE_WINDOW,
910 .default_num = 0,
911 .text = "Whether an alert is triggered by activity."
914 { .name = "monitor-bell",
915 .type = OPTIONS_TABLE_FLAG,
916 .scope = OPTIONS_TABLE_WINDOW,
917 .default_num = 1,
918 .text = "Whether an alert is triggered by a bell."
921 { .name = "monitor-silence",
922 .type = OPTIONS_TABLE_NUMBER,
923 .scope = OPTIONS_TABLE_WINDOW,
924 .minimum = 0,
925 .maximum = INT_MAX,
926 .default_num = 0,
927 .text = "Time after which an alert is triggered by silence. "
928 "Zero means no alert."
932 { .name = "other-pane-height",
933 .type = OPTIONS_TABLE_STRING,
934 .scope = OPTIONS_TABLE_WINDOW,
935 .default_str = "0",
936 .text = "Height of the other panes in the 'main-horizontal' layout. "
937 "This may be a percentage, for example '10%'."
940 { .name = "other-pane-width",
941 .type = OPTIONS_TABLE_STRING,
942 .scope = OPTIONS_TABLE_WINDOW,
943 .default_str = "0",
944 .text = "Height of the other panes in the 'main-vertical' layout. "
945 "This may be a percentage, for example '10%'."
948 { .name = "pane-active-border-style",
949 .type = OPTIONS_TABLE_STRING,
950 .scope = OPTIONS_TABLE_WINDOW,
951 .default_str = "#{?pane_in_mode,fg=yellow,#{?synchronize-panes,fg=red,fg=green}}",
952 .flags = OPTIONS_TABLE_IS_STYLE,
953 .separator = ",",
954 .text = "Style of the active pane border."
957 { .name = "pane-base-index",
958 .type = OPTIONS_TABLE_NUMBER,
959 .scope = OPTIONS_TABLE_WINDOW,
960 .minimum = 0,
961 .maximum = USHRT_MAX,
962 .default_num = 0,
963 .text = "Index of the first pane in each window."
966 { .name = "pane-border-format",
967 .type = OPTIONS_TABLE_STRING,
968 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
969 .default_str = "#{?pane_active,#[reverse],}#{pane_index}#[default] "
970 "\"#{pane_title}\"",
971 .text = "Format of text in the pane status lines."
974 { .name = "pane-border-lines",
975 .type = OPTIONS_TABLE_CHOICE,
976 .scope = OPTIONS_TABLE_WINDOW,
977 .choices = options_table_pane_border_lines_list,
978 .default_num = PANE_LINES_SINGLE,
979 .text = "Type of characters used to draw pane border lines. Some of "
980 "these are only supported on terminals with UTF-8 support."
983 { .name = "pane-border-status",
984 .type = OPTIONS_TABLE_CHOICE,
985 .scope = OPTIONS_TABLE_WINDOW,
986 .choices = options_table_pane_status_list,
987 .default_num = PANE_STATUS_OFF,
988 .text = "Position of the pane status lines."
991 { .name = "pane-border-style",
992 .type = OPTIONS_TABLE_STRING,
993 .scope = OPTIONS_TABLE_WINDOW,
994 .default_str = "default",
995 .flags = OPTIONS_TABLE_IS_STYLE,
996 .separator = ",",
997 .text = "Style of the pane status lines."
1000 { .name = "pane-colours",
1001 .type = OPTIONS_TABLE_COLOUR,
1002 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
1003 .default_str = "",
1004 .flags = OPTIONS_TABLE_IS_ARRAY,
1005 .text = "The default colour palette for colours zero to 255."
1008 { .name = "popup-style",
1009 .type = OPTIONS_TABLE_STRING,
1010 .scope = OPTIONS_TABLE_WINDOW,
1011 .default_str = "default",
1012 .flags = OPTIONS_TABLE_IS_STYLE,
1013 .separator = ",",
1014 .text = "Default style of popups."
1017 { .name = "popup-border-style",
1018 .type = OPTIONS_TABLE_STRING,
1019 .scope = OPTIONS_TABLE_WINDOW,
1020 .default_str = "default",
1021 .flags = OPTIONS_TABLE_IS_STYLE,
1022 .separator = ",",
1023 .text = "Default style of popup borders."
1026 { .name = "popup-border-lines",
1027 .type = OPTIONS_TABLE_CHOICE,
1028 .scope = OPTIONS_TABLE_WINDOW,
1029 .choices = options_table_popup_border_lines_list,
1030 .default_num = BOX_LINES_SINGLE,
1031 .text = "Type of characters used to draw popup border lines. Some of "
1032 "these are only supported on terminals with UTF-8 support."
1035 { .name = "remain-on-exit",
1036 .type = OPTIONS_TABLE_CHOICE,
1037 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
1038 .choices = options_table_remain_on_exit_list,
1039 .default_num = 0,
1040 .text = "Whether panes should remain ('on') or be automatically "
1041 "killed ('off' or 'failed') when the program inside exits."
1044 { .name = "synchronize-panes",
1045 .type = OPTIONS_TABLE_FLAG,
1046 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
1047 .default_num = 0,
1048 .text = "Whether typing should be sent to all panes simultaneously."
1051 { .name = "window-active-style",
1052 .type = OPTIONS_TABLE_STRING,
1053 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
1054 .default_str = "default",
1055 .flags = OPTIONS_TABLE_IS_STYLE,
1056 .separator = ",",
1057 .text = "Default style of the active pane."
1060 { .name = "window-size",
1061 .type = OPTIONS_TABLE_CHOICE,
1062 .scope = OPTIONS_TABLE_WINDOW,
1063 .choices = options_table_window_size_list,
1064 .default_num = WINDOW_SIZE_LATEST,
1065 .text = "How window size is calculated. "
1066 "'latest' uses the size of the most recently used client, "
1067 "'largest' the largest client, 'smallest' the smallest "
1068 "client and 'manual' a size set by the 'resize-window' "
1069 "command."
1072 { .name = "window-style",
1073 .type = OPTIONS_TABLE_STRING,
1074 .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
1075 .default_str = "default",
1076 .flags = OPTIONS_TABLE_IS_STYLE,
1077 .separator = ",",
1078 .text = "Default style of panes that are not the active pane."
1081 { .name = "window-status-activity-style",
1082 .type = OPTIONS_TABLE_STRING,
1083 .scope = OPTIONS_TABLE_WINDOW,
1084 .default_str = "reverse",
1085 .flags = OPTIONS_TABLE_IS_STYLE,
1086 .separator = ",",
1087 .text = "Style of windows in the status line with an activity alert."
1090 { .name = "window-status-bell-style",
1091 .type = OPTIONS_TABLE_STRING,
1092 .scope = OPTIONS_TABLE_WINDOW,
1093 .default_str = "reverse",
1094 .flags = OPTIONS_TABLE_IS_STYLE,
1095 .separator = ",",
1096 .text = "Style of windows in the status line with a bell alert."
1099 { .name = "window-status-current-format",
1100 .type = OPTIONS_TABLE_STRING,
1101 .scope = OPTIONS_TABLE_WINDOW,
1102 .default_str = "#I:#W#{?window_flags,#{window_flags}, }",
1103 .text = "Format of the current window in the status line."
1106 { .name = "window-status-current-style",
1107 .type = OPTIONS_TABLE_STRING,
1108 .scope = OPTIONS_TABLE_WINDOW,
1109 .default_str = "default",
1110 .flags = OPTIONS_TABLE_IS_STYLE,
1111 .separator = ",",
1112 .text = "Style of the current window in the status line."
1115 { .name = "window-status-format",
1116 .type = OPTIONS_TABLE_STRING,
1117 .scope = OPTIONS_TABLE_WINDOW,
1118 .default_str = "#I:#W#{?window_flags,#{window_flags}, }",
1119 .text = "Format of windows in the status line, except the current "
1120 "window."
1123 { .name = "window-status-last-style",
1124 .type = OPTIONS_TABLE_STRING,
1125 .scope = OPTIONS_TABLE_WINDOW,
1126 .default_str = "default",
1127 .flags = OPTIONS_TABLE_IS_STYLE,
1128 .separator = ",",
1129 .text = "Style of the last window in the status line."
1132 { .name = "window-status-separator",
1133 .type = OPTIONS_TABLE_STRING,
1134 .scope = OPTIONS_TABLE_WINDOW,
1135 .default_str = " ",
1136 .text = "Separator between windows in the status line."
1139 { .name = "window-status-style",
1140 .type = OPTIONS_TABLE_STRING,
1141 .scope = OPTIONS_TABLE_WINDOW,
1142 .default_str = "default",
1143 .flags = OPTIONS_TABLE_IS_STYLE,
1144 .separator = ",",
1145 .text = "Style of windows in the status line, except the current and "
1146 "last windows."
1149 { .name = "wrap-search",
1150 .type = OPTIONS_TABLE_FLAG,
1151 .scope = OPTIONS_TABLE_WINDOW,
1152 .default_num = 1,
1153 .text = "Whether searching in copy mode should wrap at the top or "
1154 "bottom."
1157 { .name = "xterm-keys", /* no longer used */
1158 .type = OPTIONS_TABLE_FLAG,
1159 .scope = OPTIONS_TABLE_WINDOW,
1160 .default_num = 1,
1161 .text = "Whether xterm-style function key sequences should be sent. "
1162 "This option is no longer used."
1165 /* Hook options. */
1166 OPTIONS_TABLE_HOOK("after-bind-key", ""),
1167 OPTIONS_TABLE_HOOK("after-capture-pane", ""),
1168 OPTIONS_TABLE_HOOK("after-copy-mode", ""),
1169 OPTIONS_TABLE_HOOK("after-display-message", ""),
1170 OPTIONS_TABLE_HOOK("after-display-panes", ""),
1171 OPTIONS_TABLE_HOOK("after-kill-pane", ""),
1172 OPTIONS_TABLE_HOOK("after-list-buffers", ""),
1173 OPTIONS_TABLE_HOOK("after-list-clients", ""),
1174 OPTIONS_TABLE_HOOK("after-list-keys", ""),
1175 OPTIONS_TABLE_HOOK("after-list-panes", ""),
1176 OPTIONS_TABLE_HOOK("after-list-sessions", ""),
1177 OPTIONS_TABLE_HOOK("after-list-windows", ""),
1178 OPTIONS_TABLE_HOOK("after-load-buffer", ""),
1179 OPTIONS_TABLE_HOOK("after-lock-server", ""),
1180 OPTIONS_TABLE_HOOK("after-new-session", ""),
1181 OPTIONS_TABLE_HOOK("after-new-window", ""),
1182 OPTIONS_TABLE_HOOK("after-paste-buffer", ""),
1183 OPTIONS_TABLE_HOOK("after-pipe-pane", ""),
1184 OPTIONS_TABLE_HOOK("after-queue", ""),
1185 OPTIONS_TABLE_HOOK("after-refresh-client", ""),
1186 OPTIONS_TABLE_HOOK("after-rename-session", ""),
1187 OPTIONS_TABLE_HOOK("after-rename-window", ""),
1188 OPTIONS_TABLE_HOOK("after-resize-pane", ""),
1189 OPTIONS_TABLE_HOOK("after-resize-window", ""),
1190 OPTIONS_TABLE_HOOK("after-save-buffer", ""),
1191 OPTIONS_TABLE_HOOK("after-select-layout", ""),
1192 OPTIONS_TABLE_HOOK("after-select-pane", ""),
1193 OPTIONS_TABLE_HOOK("after-select-window", ""),
1194 OPTIONS_TABLE_HOOK("after-send-keys", ""),
1195 OPTIONS_TABLE_HOOK("after-set-buffer", ""),
1196 OPTIONS_TABLE_HOOK("after-set-environment", ""),
1197 OPTIONS_TABLE_HOOK("after-set-hook", ""),
1198 OPTIONS_TABLE_HOOK("after-set-option", ""),
1199 OPTIONS_TABLE_HOOK("after-show-environment", ""),
1200 OPTIONS_TABLE_HOOK("after-show-messages", ""),
1201 OPTIONS_TABLE_HOOK("after-show-options", ""),
1202 OPTIONS_TABLE_HOOK("after-split-window", ""),
1203 OPTIONS_TABLE_HOOK("after-unbind-key", ""),
1204 OPTIONS_TABLE_HOOK("alert-activity", ""),
1205 OPTIONS_TABLE_HOOK("alert-bell", ""),
1206 OPTIONS_TABLE_HOOK("alert-silence", ""),
1207 OPTIONS_TABLE_HOOK("client-active", ""),
1208 OPTIONS_TABLE_HOOK("client-attached", ""),
1209 OPTIONS_TABLE_HOOK("client-detached", ""),
1210 OPTIONS_TABLE_HOOK("client-focus-in", ""),
1211 OPTIONS_TABLE_HOOK("client-focus-out", ""),
1212 OPTIONS_TABLE_HOOK("client-resized", ""),
1213 OPTIONS_TABLE_HOOK("client-session-changed", ""),
1214 OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
1215 OPTIONS_TABLE_PANE_HOOK("pane-exited", ""),
1216 OPTIONS_TABLE_PANE_HOOK("pane-focus-in", ""),
1217 OPTIONS_TABLE_PANE_HOOK("pane-focus-out", ""),
1218 OPTIONS_TABLE_PANE_HOOK("pane-mode-changed", ""),
1219 OPTIONS_TABLE_PANE_HOOK("pane-set-clipboard", ""),
1220 OPTIONS_TABLE_PANE_HOOK("pane-title-changed", ""),
1221 OPTIONS_TABLE_HOOK("session-closed", ""),
1222 OPTIONS_TABLE_HOOK("session-created", ""),
1223 OPTIONS_TABLE_HOOK("session-renamed", ""),
1224 OPTIONS_TABLE_HOOK("session-window-changed", ""),
1225 OPTIONS_TABLE_WINDOW_HOOK("window-layout-changed", ""),
1226 OPTIONS_TABLE_HOOK("window-linked", ""),
1227 OPTIONS_TABLE_WINDOW_HOOK("window-pane-changed", ""),
1228 OPTIONS_TABLE_WINDOW_HOOK("window-renamed", ""),
1229 OPTIONS_TABLE_HOOK("window-unlinked", ""),
1231 { .name = NULL }