options-table.c revision 1.140
1/* $OpenBSD: options-table.c,v 1.140 2021/03/11 06:41:04 nicm Exp $ */
2
3/*
4 * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
5 *
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.
9 *
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.
17 */
18
19#include <sys/types.h>
20
21#include <string.h>
22#include <paths.h>
23
24#include "tmux.h"
25
26/*
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.
33 */
34
35/* Choice option type lists. */
36static const char *options_table_mode_keys_list[] = {
37	"emacs", "vi", NULL
38};
39static const char *options_table_clock_mode_style_list[] = {
40	"12", "24", NULL
41};
42static const char *options_table_status_list[] = {
43	"off", "on", "2", "3", "4", "5", NULL
44};
45static const char *options_table_status_keys_list[] = {
46	"emacs", "vi", NULL
47};
48static const char *options_table_status_justify_list[] = {
49	"left", "centre", "right", "absolute-centre", NULL
50};
51static const char *options_table_status_position_list[] = {
52	"top", "bottom", NULL
53};
54static const char *options_table_bell_action_list[] = {
55	"none", "any", "current", "other", NULL
56};
57static const char *options_table_visual_bell_list[] = {
58	"off", "on", "both", NULL
59};
60static const char *options_table_pane_status_list[] = {
61	"off", "top", "bottom", NULL
62};
63static const char *options_table_pane_lines_list[] = {
64	"single", "double", "heavy", "simple", "number", NULL
65};
66static const char *options_table_set_clipboard_list[] = {
67	"off", "external", "on", NULL
68};
69static const char *options_table_window_size_list[] = {
70	"largest", "smallest", "manual", "latest", NULL
71};
72static const char *options_table_remain_on_exit_list[] = {
73	"off", "on", "failed", NULL
74};
75static const char *options_table_detach_on_destroy_list[] = {
76	"off", "on", "no-detached", NULL
77};
78
79/* Status line format. */
80#define OPTIONS_TABLE_STATUS_FORMAT1 \
81	"#[align=left range=left #{status-left-style}]" \
82	"#[push-default]" \
83	"#{T;=/#{status-left-length}:status-left}" \
84	"#[pop-default]" \
85	"#[norange default]" \
86	"#[list=on align=#{status-justify}]" \
87	"#[list=left-marker]<#[list=right-marker]>#[list=on]" \
88	"#{W:" \
89		"#[range=window|#{window_index} " \
90			"#{window-status-style}" \
91			"#{?#{&&:#{window_last_flag}," \
92				"#{!=:#{window-status-last-style},default}}, " \
93				"#{window-status-last-style}," \
94			"}" \
95			"#{?#{&&:#{window_bell_flag}," \
96				"#{!=:#{window-status-bell-style},default}}, " \
97				"#{window-status-bell-style}," \
98				"#{?#{&&:#{||:#{window_activity_flag}," \
99					     "#{window_silence_flag}}," \
100					"#{!=:" \
101					"#{window-status-activity-style}," \
102					"default}}, " \
103					"#{window-status-activity-style}," \
104				"}" \
105			"}" \
106		"]" \
107		"#[push-default]" \
108		"#{T:window-status-format}" \
109		"#[pop-default]" \
110		"#[norange default]" \
111		"#{?window_end_flag,,#{window-status-separator}}" \
112	"," \
113		"#[range=window|#{window_index} list=focus " \
114			"#{?#{!=:#{window-status-current-style},default}," \
115				"#{window-status-current-style}," \
116				"#{window-status-style}" \
117			"}" \
118			"#{?#{&&:#{window_last_flag}," \
119				"#{!=:#{window-status-last-style},default}}, " \
120				"#{window-status-last-style}," \
121			"}" \
122			"#{?#{&&:#{window_bell_flag}," \
123				"#{!=:#{window-status-bell-style},default}}, " \
124				"#{window-status-bell-style}," \
125				"#{?#{&&:#{||:#{window_activity_flag}," \
126					     "#{window_silence_flag}}," \
127					"#{!=:" \
128					"#{window-status-activity-style}," \
129					"default}}, " \
130					"#{window-status-activity-style}," \
131				"}" \
132			"}" \
133		"]" \
134		"#[push-default]" \
135		"#{T:window-status-current-format}" \
136		"#[pop-default]" \
137		"#[norange list=on default]" \
138		"#{?window_end_flag,,#{window-status-separator}}" \
139	"}" \
140	"#[nolist align=right range=right #{status-right-style}]" \
141	"#[push-default]" \
142	"#{T;=/#{status-right-length}:status-right}" \
143	"#[pop-default]" \
144	"#[norange default]"
145#define OPTIONS_TABLE_STATUS_FORMAT2 \
146	"#[align=centre]#{P:#{?pane_active,#[reverse],}" \
147	"#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
148static const char *options_table_status_format_default[] = {
149	OPTIONS_TABLE_STATUS_FORMAT1, OPTIONS_TABLE_STATUS_FORMAT2, NULL
150};
151
152/* Helpers for hook options. */
153#define OPTIONS_TABLE_HOOK(hook_name, default_value) \
154	{ .name = hook_name, \
155	  .type = OPTIONS_TABLE_COMMAND, \
156	  .scope = OPTIONS_TABLE_SESSION, \
157	  .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
158	  .default_str = default_value,	\
159	  .separator = "" \
160	}
161
162#define OPTIONS_TABLE_PANE_HOOK(hook_name, default_value) \
163	{ .name = hook_name, \
164	  .type = OPTIONS_TABLE_COMMAND, \
165	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, \
166	  .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
167	  .default_str = default_value,	\
168	  .separator = "" \
169	}
170
171#define OPTIONS_TABLE_WINDOW_HOOK(hook_name, default_value) \
172	{ .name = hook_name, \
173	  .type = OPTIONS_TABLE_COMMAND, \
174	  .scope = OPTIONS_TABLE_WINDOW, \
175	  .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
176	  .default_str = default_value,	\
177	  .separator = "" \
178	}
179
180/* Map of name conversions. */
181const struct options_name_map options_other_names[] = {
182	{ "display-panes-color", "display-panes-colour" },
183	{ "display-panes-active-color", "display-panes-active-colour" },
184	{ "clock-mode-color", "clock-mode-colour" },
185	{ NULL, NULL }
186};
187
188/* Top-level options. */
189const struct options_table_entry options_table[] = {
190	/* Server options. */
191	{ .name = "backspace",
192	  .type = OPTIONS_TABLE_KEY,
193	  .scope = OPTIONS_TABLE_SERVER,
194	  .default_num = '\177',
195	  .text = "The key to send for backspace."
196	},
197
198	{ .name = "buffer-limit",
199	  .type = OPTIONS_TABLE_NUMBER,
200	  .scope = OPTIONS_TABLE_SERVER,
201	  .minimum = 1,
202	  .maximum = INT_MAX,
203	  .default_num = 50,
204	  .text = "The maximum number of automatic buffers. "
205		  "When this is reached, the oldest buffer is deleted."
206	},
207
208	{ .name = "command-alias",
209	  .type = OPTIONS_TABLE_STRING,
210	  .scope = OPTIONS_TABLE_SERVER,
211	  .flags = OPTIONS_TABLE_IS_ARRAY,
212	  .default_str = "split-pane=split-window,"
213			 "splitp=split-window,"
214			 "server-info=show-messages -JT,"
215			 "info=show-messages -JT,"
216			 "choose-window=choose-tree -w,"
217			 "choose-session=choose-tree -s",
218	  .separator = ",",
219	  .text = "Array of command aliases. "
220		  "Each entry is an alias and a command separated by '='."
221	},
222
223	{ .name = "copy-command",
224	  .type = OPTIONS_TABLE_STRING,
225	  .scope = OPTIONS_TABLE_SERVER,
226	  .default_str = "",
227	  .text = "Shell command run when text is copied. "
228		  "If empty, no command is run."
229	},
230
231	{ .name = "default-terminal",
232	  .type = OPTIONS_TABLE_STRING,
233	  .scope = OPTIONS_TABLE_SERVER,
234	  .default_str = "screen",
235	  .text = "Default for the 'TERM' environment variable."
236	},
237
238	{ .name = "editor",
239	  .type = OPTIONS_TABLE_STRING,
240	  .scope = OPTIONS_TABLE_SERVER,
241	  .default_str = _PATH_VI,
242	  .text = "Editor run to edit files."
243	},
244
245	{ .name = "escape-time",
246	  .type = OPTIONS_TABLE_NUMBER,
247	  .scope = OPTIONS_TABLE_SERVER,
248	  .minimum = 0,
249	  .maximum = INT_MAX,
250	  .default_num = 500,
251	  .text = "Time to wait before assuming a key is Escape."
252	},
253
254	{ .name = "exit-empty",
255	  .type = OPTIONS_TABLE_FLAG,
256	  .scope = OPTIONS_TABLE_SERVER,
257	  .default_num = 1,
258	  .text = "Whether the server should exit if there are no sessions."
259	},
260
261	{ .name = "exit-unattached",
262	  .type = OPTIONS_TABLE_FLAG,
263	  .scope = OPTIONS_TABLE_SERVER,
264	  .default_num = 0,
265	  .text = "Whether the server should exit if there are no attached "
266		  "clients."
267	},
268
269	{ .name = "extended-keys",
270	  .type = OPTIONS_TABLE_FLAG,
271	  .scope = OPTIONS_TABLE_SERVER,
272	  .default_num = 0,
273	  .text = "Whether to request extended key sequences from terminals "
274	          "that support it."
275	},
276
277	{ .name = "focus-events",
278	  .type = OPTIONS_TABLE_FLAG,
279	  .scope = OPTIONS_TABLE_SERVER,
280	  .default_num = 0,
281	  .text = "Whether to send focus events to applications."
282	},
283
284	{ .name = "history-file",
285	  .type = OPTIONS_TABLE_STRING,
286	  .scope = OPTIONS_TABLE_SERVER,
287	  .default_str = "",
288	  .text = "Location of the command prompt history file. "
289		  "Empty does not write a history file."
290	},
291
292	{ .name = "message-limit",
293	  .type = OPTIONS_TABLE_NUMBER,
294	  .scope = OPTIONS_TABLE_SERVER,
295	  .minimum = 0,
296	  .maximum = INT_MAX,
297	  .default_num = 1000,
298	  .text = "Maximum number of server messages to keep."
299	},
300
301	{ .name = "set-clipboard",
302	  .type = OPTIONS_TABLE_CHOICE,
303	  .scope = OPTIONS_TABLE_SERVER,
304	  .choices = options_table_set_clipboard_list,
305	  .default_num = 1,
306	  .text = "Whether to attempt to set the system clipboard ('on' or "
307		  "'external') and whether to allow applications to create "
308		  "paste buffers with an escape sequence ('on' only)."
309	},
310
311	{ .name = "terminal-overrides",
312	  .type = OPTIONS_TABLE_STRING,
313	  .scope = OPTIONS_TABLE_SERVER,
314	  .flags = OPTIONS_TABLE_IS_ARRAY,
315	  .default_str = "",
316	  .separator = ",",
317	  .text = "List of terminal capabilities overrides."
318	},
319
320	{ .name = "terminal-features",
321	  .type = OPTIONS_TABLE_STRING,
322	  .scope = OPTIONS_TABLE_SERVER,
323	  .flags = OPTIONS_TABLE_IS_ARRAY,
324	  .default_str = "xterm*:clipboard:ccolour:cstyle:focus:title,"
325			 "screen*:title",
326	  .separator = ",",
327	  .text = "List of terminal features, used if they cannot be "
328		  "automatically detected."
329	},
330
331	{ .name = "user-keys",
332	  .type = OPTIONS_TABLE_STRING,
333	  .scope = OPTIONS_TABLE_SERVER,
334	  .flags = OPTIONS_TABLE_IS_ARRAY,
335	  .default_str = "",
336	  .separator = ",",
337	  .text = "User key assignments. "
338		  "Each sequence in the list is translated into a key: "
339		  "'User0', 'User1' and so on."
340	},
341
342	/* Session options. */
343	{ .name = "activity-action",
344	  .type = OPTIONS_TABLE_CHOICE,
345	  .scope = OPTIONS_TABLE_SESSION,
346	  .choices = options_table_bell_action_list,
347	  .default_num = ALERT_OTHER,
348	  .text = "Action to take on an activity alert."
349	},
350
351	{ .name = "assume-paste-time",
352	  .type = OPTIONS_TABLE_NUMBER,
353	  .scope = OPTIONS_TABLE_SESSION,
354	  .minimum = 0,
355	  .maximum = INT_MAX,
356	  .default_num = 1,
357	  .unit = "milliseconds",
358	  .text = "Maximum time between input to assume it pasting rather "
359		  "than typing."
360	},
361
362	{ .name = "base-index",
363	  .type = OPTIONS_TABLE_NUMBER,
364	  .scope = OPTIONS_TABLE_SESSION,
365	  .minimum = 0,
366	  .maximum = INT_MAX,
367	  .default_num = 0,
368	  .text = "Default index of the first window in each session."
369	},
370
371	{ .name = "bell-action",
372	  .type = OPTIONS_TABLE_CHOICE,
373	  .scope = OPTIONS_TABLE_SESSION,
374	  .choices = options_table_bell_action_list,
375	  .default_num = ALERT_ANY,
376	  .text = "Action to take on a bell alert."
377	},
378
379	{ .name = "default-command",
380	  .type = OPTIONS_TABLE_STRING,
381	  .scope = OPTIONS_TABLE_SESSION,
382	  .default_str = "",
383	  .text = "Default command to run in new panes. If empty, a shell is "
384		  "started."
385	},
386
387	{ .name = "default-shell",
388	  .type = OPTIONS_TABLE_STRING,
389	  .scope = OPTIONS_TABLE_SESSION,
390	  .default_str = _PATH_BSHELL,
391	  .text = "Location of default shell."
392	},
393
394	{ .name = "default-size",
395	  .type = OPTIONS_TABLE_STRING,
396	  .scope = OPTIONS_TABLE_SESSION,
397	  .pattern = "[0-9]*x[0-9]*",
398	  .default_str = "80x24",
399	  .text = "Initial size of new sessions."
400	},
401
402	{ .name = "destroy-unattached",
403	  .type = OPTIONS_TABLE_FLAG,
404	  .scope = OPTIONS_TABLE_SESSION,
405	  .default_num = 0,
406	  .text = "Whether to destroy sessions when they have no attached "
407		  "clients."
408	},
409
410	{ .name = "detach-on-destroy",
411	  .type = OPTIONS_TABLE_CHOICE,
412	  .scope = OPTIONS_TABLE_SESSION,
413	  .choices = options_table_detach_on_destroy_list,
414	  .default_num = 1,
415	  .text = "Whether to detach when a session is destroyed, or switch "
416		  "the client to another session if any exist."
417	},
418
419	{ .name = "display-panes-active-colour",
420	  .type = OPTIONS_TABLE_COLOUR,
421	  .scope = OPTIONS_TABLE_SESSION,
422	  .default_num = 1,
423	  .text = "Colour of the active pane for 'display-panes'."
424	},
425
426	{ .name = "display-panes-colour",
427	  .type = OPTIONS_TABLE_COLOUR,
428	  .scope = OPTIONS_TABLE_SESSION,
429	  .default_num = 4,
430	  .text = "Colour of not active panes for 'display-panes'."
431	},
432
433	{ .name = "display-panes-time",
434	  .type = OPTIONS_TABLE_NUMBER,
435	  .scope = OPTIONS_TABLE_SESSION,
436	  .minimum = 1,
437	  .maximum = INT_MAX,
438	  .default_num = 1000,
439	  .unit = "milliseconds",
440	  .text = "Time for which 'display-panes' should show pane numbers."
441	},
442
443	{ .name = "display-time",
444	  .type = OPTIONS_TABLE_NUMBER,
445	  .scope = OPTIONS_TABLE_SESSION,
446	  .minimum = 0,
447	  .maximum = INT_MAX,
448	  .default_num = 750,
449	  .unit = "milliseconds",
450	  .text = "Time for which status line messages should appear."
451	},
452
453	{ .name = "history-limit",
454	  .type = OPTIONS_TABLE_NUMBER,
455	  .scope = OPTIONS_TABLE_SESSION,
456	  .minimum = 0,
457	  .maximum = INT_MAX,
458	  .default_num = 2000,
459	  .unit = "lines",
460	  .text = "Maximum number of lines to keep in the history for each "
461		  "pane. "
462		  "If changed, the new value applies only to new panes."
463	},
464
465	{ .name = "key-table",
466	  .type = OPTIONS_TABLE_STRING,
467	  .scope = OPTIONS_TABLE_SESSION,
468	  .default_str = "root",
469	  .text = "Default key table. "
470		  "Key presses are first looked up in this table."
471	},
472
473	{ .name = "lock-after-time",
474	  .type = OPTIONS_TABLE_NUMBER,
475	  .scope = OPTIONS_TABLE_SESSION,
476	  .minimum = 0,
477	  .maximum = INT_MAX,
478	  .default_num = 0,
479	  .unit = "seconds",
480	  .text = "Time after which a client is locked if not used."
481	},
482
483	{ .name = "lock-command",
484	  .type = OPTIONS_TABLE_STRING,
485	  .scope = OPTIONS_TABLE_SESSION,
486	  .default_str = "lock -np",
487	  .text = "Shell command to run to lock a client."
488	},
489
490	{ .name = "message-command-style",
491	  .type = OPTIONS_TABLE_STRING,
492	  .scope = OPTIONS_TABLE_SESSION,
493	  .default_str = "bg=black,fg=yellow",
494	  .flags = OPTIONS_TABLE_IS_STYLE,
495	  .separator = ",",
496	  .text = "Style of the command prompt when in command mode, if "
497		  "'mode-keys' is set to 'vi'."
498	},
499
500	{ .name = "message-style",
501	  .type = OPTIONS_TABLE_STRING,
502	  .scope = OPTIONS_TABLE_SESSION,
503	  .default_str = "bg=yellow,fg=black",
504	  .flags = OPTIONS_TABLE_IS_STYLE,
505	  .separator = ",",
506	  .text = "Style of the command prompt."
507	},
508
509	{ .name = "mouse",
510	  .type = OPTIONS_TABLE_FLAG,
511	  .scope = OPTIONS_TABLE_SESSION,
512	  .default_num = 0,
513	  .text = "Whether the mouse is recognised and mouse key bindings are "
514		  "executed. "
515		  "Applications inside panes can use the mouse even when 'off'."
516	},
517
518	{ .name = "prefix",
519	  .type = OPTIONS_TABLE_KEY,
520	  .scope = OPTIONS_TABLE_SESSION,
521	  .default_num = '\002',
522	  .text = "The prefix key."
523	},
524
525	{ .name = "prefix2",
526	  .type = OPTIONS_TABLE_KEY,
527	  .scope = OPTIONS_TABLE_SESSION,
528	  .default_num = KEYC_NONE,
529	  .text = "A second prefix key."
530	},
531
532	{ .name = "renumber-windows",
533	  .type = OPTIONS_TABLE_FLAG,
534	  .scope = OPTIONS_TABLE_SESSION,
535	  .default_num = 0,
536	  .text = "Whether windows are automatically renumbered rather than "
537		  "leaving gaps."
538	},
539
540	{ .name = "repeat-time",
541	  .type = OPTIONS_TABLE_NUMBER,
542	  .scope = OPTIONS_TABLE_SESSION,
543	  .minimum = 0,
544	  .maximum = SHRT_MAX,
545	  .default_num = 500,
546	  .unit = "milliseconds",
547	  .text = "Time to wait for a key binding to repeat, if it is bound "
548		  "with the '-r' flag."
549	},
550
551	{ .name = "set-titles",
552	  .type = OPTIONS_TABLE_FLAG,
553	  .scope = OPTIONS_TABLE_SESSION,
554	  .default_num = 0,
555	  .text = "Whether to set the terminal title, if supported."
556	},
557
558	{ .name = "set-titles-string",
559	  .type = OPTIONS_TABLE_STRING,
560	  .scope = OPTIONS_TABLE_SESSION,
561	  .default_str = "#S:#I:#W - \"#T\" #{session_alerts}",
562	  .text = "Format of the terminal title to set."
563	},
564
565	{ .name = "silence-action",
566	  .type = OPTIONS_TABLE_CHOICE,
567	  .scope = OPTIONS_TABLE_SESSION,
568	  .choices = options_table_bell_action_list,
569	  .default_num = ALERT_OTHER,
570	  .text = "Action to take on a silence alert."
571	},
572
573	{ .name = "status",
574	  .type = OPTIONS_TABLE_CHOICE,
575	  .scope = OPTIONS_TABLE_SESSION,
576	  .choices = options_table_status_list,
577	  .default_num = 1,
578	  .text = "Number of lines in the status line."
579	},
580
581	{ .name = "status-bg",
582	  .type = OPTIONS_TABLE_COLOUR,
583	  .scope = OPTIONS_TABLE_SESSION,
584	  .default_num = 8,
585	  .text = "Background colour of the status line. This option is "
586		  "deprecated, use 'status-style' instead."
587	},
588
589	{ .name = "status-fg",
590	  .type = OPTIONS_TABLE_COLOUR,
591	  .scope = OPTIONS_TABLE_SESSION,
592	  .default_num = 8,
593	  .text = "Foreground colour of the status line. This option is "
594		  "deprecated, use 'status-style' instead."
595	},
596
597	{ .name = "status-format",
598	  .type = OPTIONS_TABLE_STRING,
599	  .scope = OPTIONS_TABLE_SESSION,
600	  .flags = OPTIONS_TABLE_IS_ARRAY,
601	  .default_arr = options_table_status_format_default,
602	  .text = "Formats for the status lines. "
603		  "Each array member is the format for one status line. "
604		  "The default status line is made up of several components "
605		  "which may be configured individually with other option such "
606		  "as 'status-left'."
607	},
608
609	{ .name = "status-interval",
610	  .type = OPTIONS_TABLE_NUMBER,
611	  .scope = OPTIONS_TABLE_SESSION,
612	  .minimum = 0,
613	  .maximum = INT_MAX,
614	  .default_num = 15,
615	  .unit = "seconds",
616	  .text = "Number of seconds between status line updates."
617	},
618
619	{ .name = "status-justify",
620	  .type = OPTIONS_TABLE_CHOICE,
621	  .scope = OPTIONS_TABLE_SESSION,
622	  .choices = options_table_status_justify_list,
623	  .default_num = 0,
624	  .text = "Position of the window list in the status line."
625	},
626
627	{ .name = "status-keys",
628	  .type = OPTIONS_TABLE_CHOICE,
629	  .scope = OPTIONS_TABLE_SESSION,
630	  .choices = options_table_status_keys_list,
631	  .default_num = MODEKEY_EMACS,
632	  .text = "Key set to use at the command prompt."
633	},
634
635	{ .name = "status-left",
636	  .type = OPTIONS_TABLE_STRING,
637	  .scope = OPTIONS_TABLE_SESSION,
638	  .default_str = "[#{session_name}] ",
639	  .text = "Contents of the left side of the status line."
640	},
641
642	{ .name = "status-left-length",
643	  .type = OPTIONS_TABLE_NUMBER,
644	  .scope = OPTIONS_TABLE_SESSION,
645	  .minimum = 0,
646	  .maximum = SHRT_MAX,
647	  .default_num = 10,
648	  .text = "Maximum width of the left side of the status line."
649	},
650
651	{ .name = "status-left-style",
652	  .type = OPTIONS_TABLE_STRING,
653	  .scope = OPTIONS_TABLE_SESSION,
654	  .default_str = "default",
655	  .flags = OPTIONS_TABLE_IS_STYLE,
656	  .separator = ",",
657	  .text = "Style of the left side of the status line."
658	},
659
660	{ .name = "status-position",
661	  .type = OPTIONS_TABLE_CHOICE,
662	  .scope = OPTIONS_TABLE_SESSION,
663	  .choices = options_table_status_position_list,
664	  .default_num = 1,
665	  .text = "Position of the status line."
666	},
667
668	{ .name = "status-right",
669	  .type = OPTIONS_TABLE_STRING,
670	  .scope = OPTIONS_TABLE_SESSION,
671	  .default_str = "#{?window_bigger,"
672			 "[#{window_offset_x}#,#{window_offset_y}] ,}"
673			 "\"#{=21:pane_title}\" %H:%M %d-%b-%y",
674	  .text = "Contents of the right side of the status line."
675
676	},
677
678	{ .name = "status-right-length",
679	  .type = OPTIONS_TABLE_NUMBER,
680	  .scope = OPTIONS_TABLE_SESSION,
681	  .minimum = 0,
682	  .maximum = SHRT_MAX,
683	  .default_num = 40,
684	  .text = "Maximum width of the right side of the status line."
685	},
686
687	{ .name = "status-right-style",
688	  .type = OPTIONS_TABLE_STRING,
689	  .scope = OPTIONS_TABLE_SESSION,
690	  .default_str = "default",
691	  .flags = OPTIONS_TABLE_IS_STYLE,
692	  .separator = ",",
693	  .text = "Style of the right side of the status line."
694	},
695
696	{ .name = "status-style",
697	  .type = OPTIONS_TABLE_STRING,
698	  .scope = OPTIONS_TABLE_SESSION,
699	  .default_str = "bg=green,fg=black",
700	  .flags = OPTIONS_TABLE_IS_STYLE,
701	  .separator = ",",
702	  .text = "Style of the status line."
703	},
704
705	{ .name = "update-environment",
706	  .type = OPTIONS_TABLE_STRING,
707	  .scope = OPTIONS_TABLE_SESSION,
708	  .flags = OPTIONS_TABLE_IS_ARRAY,
709	  .default_str = "DISPLAY KRB5CCNAME SSH_ASKPASS SSH_AUTH_SOCK "
710			 "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY",
711	  .text = "List of environment variables to update in the session "
712		  "environment when a client is attached."
713	},
714
715	{ .name = "visual-activity",
716	  .type = OPTIONS_TABLE_CHOICE,
717	  .scope = OPTIONS_TABLE_SESSION,
718	  .choices = options_table_visual_bell_list,
719	  .default_num = VISUAL_OFF,
720	  .text = "How activity alerts should be shown: a message ('on'), "
721		  "a message and a bell ('both') or nothing ('off')."
722	},
723
724	{ .name = "visual-bell",
725	  .type = OPTIONS_TABLE_CHOICE,
726	  .scope = OPTIONS_TABLE_SESSION,
727	  .choices = options_table_visual_bell_list,
728	  .default_num = VISUAL_OFF,
729	  .text = "How bell alerts should be shown: a message ('on'), "
730		  "a message and a bell ('both') or nothing ('off')."
731	},
732
733	{ .name = "visual-silence",
734	  .type = OPTIONS_TABLE_CHOICE,
735	  .scope = OPTIONS_TABLE_SESSION,
736	  .choices = options_table_visual_bell_list,
737	  .default_num = VISUAL_OFF,
738	  .text = "How silence alerts should be shown: a message ('on'), "
739		  "a message and a bell ('both') or nothing ('off')."
740	},
741
742	{ .name = "word-separators",
743	  .type = OPTIONS_TABLE_STRING,
744	  .scope = OPTIONS_TABLE_SESSION,
745	  .default_str = " ",
746	  .text = "Characters considered to separate words."
747	},
748
749	/* Window options. */
750	{ .name = "aggressive-resize",
751	  .type = OPTIONS_TABLE_FLAG,
752	  .scope = OPTIONS_TABLE_WINDOW,
753	  .default_num = 0,
754	  .text = "When 'window-size' is 'smallest', whether the maximum size "
755		  "of a window is the smallest attached session where it is "
756		  "the current window ('on') or the smallest session it is "
757		  "linked to ('off')."
758	},
759
760	{ .name = "allow-rename",
761	  .type = OPTIONS_TABLE_FLAG,
762	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
763	  .default_num = 0,
764	  .text = "Whether applications are allowed to use the escape sequence "
765		  "to rename windows."
766	},
767
768	{ .name = "alternate-screen",
769	  .type = OPTIONS_TABLE_FLAG,
770	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
771	  .default_num = 1,
772	  .text = "Whether applications are allowed to use the alternate "
773		  "screen."
774	},
775
776	{ .name = "automatic-rename",
777	  .type = OPTIONS_TABLE_FLAG,
778	  .scope = OPTIONS_TABLE_WINDOW,
779	  .default_num = 1,
780	  .text = "Whether windows are automatically renamed."
781	},
782
783	{ .name = "automatic-rename-format",
784	  .type = OPTIONS_TABLE_STRING,
785	  .scope = OPTIONS_TABLE_WINDOW,
786	  .default_str = "#{?pane_in_mode,[tmux],#{pane_current_command}}"
787			 "#{?pane_dead,[dead],}",
788	  .text = "Format used to automatically rename windows."
789	},
790
791	{ .name = "clock-mode-colour",
792	  .type = OPTIONS_TABLE_COLOUR,
793	  .scope = OPTIONS_TABLE_WINDOW,
794	  .default_num = 4,
795	  .text = "Colour of the clock in clock mode."
796	},
797
798	{ .name = "clock-mode-style",
799	  .type = OPTIONS_TABLE_CHOICE,
800	  .scope = OPTIONS_TABLE_WINDOW,
801	  .choices = options_table_clock_mode_style_list,
802	  .default_num = 1,
803	  .text = "Time format of the clock in clock mode."
804	},
805
806	{ .name = "copy-mode-match-style",
807	  .type = OPTIONS_TABLE_STRING,
808	  .scope = OPTIONS_TABLE_WINDOW,
809	  .default_str = "bg=cyan,fg=black",
810	  .flags = OPTIONS_TABLE_IS_STYLE,
811	  .separator = ",",
812	  .text = "Style of search matches in copy mode."
813	},
814
815	{ .name = "copy-mode-current-match-style",
816	  .type = OPTIONS_TABLE_STRING,
817	  .scope = OPTIONS_TABLE_WINDOW,
818	  .default_str = "bg=magenta,fg=black",
819	  .flags = OPTIONS_TABLE_IS_STYLE,
820	  .separator = ",",
821	  .text = "Style of the current search match in copy mode."
822	},
823
824	{ .name = "copy-mode-mark-style",
825	  .type = OPTIONS_TABLE_STRING,
826	  .scope = OPTIONS_TABLE_WINDOW,
827	  .default_str = "bg=red,fg=black",
828	  .flags = OPTIONS_TABLE_IS_STYLE,
829	  .separator = ",",
830	  .text = "Style of the marked line in copy mode."
831	},
832
833	{ .name = "main-pane-height",
834	  .type = OPTIONS_TABLE_STRING,
835	  .scope = OPTIONS_TABLE_WINDOW,
836	  .default_str = "24",
837	  .text = "Height of the main pane in the 'main-horizontal' layout. "
838		  "This may be a percentage, for example '10%'."
839	},
840
841	{ .name = "main-pane-width",
842	  .type = OPTIONS_TABLE_STRING,
843	  .scope = OPTIONS_TABLE_WINDOW,
844	  .default_str = "80",
845	  .text = "Width of the main pane in the 'main-vertical' layout. "
846		  "This may be a percentage, for example '10%'."
847	},
848
849	{ .name = "mode-keys",
850	  .type = OPTIONS_TABLE_CHOICE,
851	  .scope = OPTIONS_TABLE_WINDOW,
852	  .choices = options_table_mode_keys_list,
853	  .default_num = MODEKEY_EMACS,
854	  .text = "Key set used in copy mode."
855	},
856
857	{ .name = "mode-style",
858	  .type = OPTIONS_TABLE_STRING,
859	  .scope = OPTIONS_TABLE_WINDOW,
860	  .default_str = "bg=yellow,fg=black",
861	  .flags = OPTIONS_TABLE_IS_STYLE,
862	  .separator = ",",
863	  .text = "Style of indicators and highlighting in modes."
864	},
865
866	{ .name = "monitor-activity",
867	  .type = OPTIONS_TABLE_FLAG,
868	  .scope = OPTIONS_TABLE_WINDOW,
869	  .default_num = 0,
870	  .text = "Whether an alert is triggered by activity."
871	},
872
873	{ .name = "monitor-bell",
874	  .type = OPTIONS_TABLE_FLAG,
875	  .scope = OPTIONS_TABLE_WINDOW,
876	  .default_num = 1,
877	  .text = "Whether an alert is triggered by a bell."
878	},
879
880	{ .name = "monitor-silence",
881	  .type = OPTIONS_TABLE_NUMBER,
882	  .scope = OPTIONS_TABLE_WINDOW,
883	  .minimum = 0,
884	  .maximum = INT_MAX,
885	  .default_num = 0,
886	  .text = "Time after which an alert is triggered by silence. "
887		  "Zero means no alert."
888
889	},
890
891	{ .name = "other-pane-height",
892	  .type = OPTIONS_TABLE_STRING,
893	  .scope = OPTIONS_TABLE_WINDOW,
894	  .default_str = "0",
895	  .text = "Height of the other panes in the 'main-horizontal' layout. "
896		  "This may be a percentage, for example '10%'."
897	},
898
899	{ .name = "other-pane-width",
900	  .type = OPTIONS_TABLE_STRING,
901	  .scope = OPTIONS_TABLE_WINDOW,
902	  .default_str = "0",
903	  .text = "Height of the other panes in the 'main-vertical' layout. "
904		  "This may be a percentage, for example '10%'."
905	},
906
907	{ .name = "pane-active-border-style",
908	  .type = OPTIONS_TABLE_STRING,
909	  .scope = OPTIONS_TABLE_WINDOW,
910	  .default_str = "#{?pane_in_mode,fg=yellow,#{?synchronize-panes,fg=red,fg=green}}",
911	  .flags = OPTIONS_TABLE_IS_STYLE,
912	  .separator = ",",
913	  .text = "Style of the active pane border."
914	},
915
916	{ .name = "pane-base-index",
917	  .type = OPTIONS_TABLE_NUMBER,
918	  .scope = OPTIONS_TABLE_WINDOW,
919	  .minimum = 0,
920	  .maximum = USHRT_MAX,
921	  .default_num = 0,
922	  .text = "Index of the first pane in each window."
923	},
924
925	{ .name = "pane-border-format",
926	  .type = OPTIONS_TABLE_STRING,
927	  .scope = OPTIONS_TABLE_WINDOW,
928	  .default_str = "#{?pane_active,#[reverse],}#{pane_index}#[default] "
929			 "\"#{pane_title}\"",
930	  .text = "Format of text in the pane status lines."
931	},
932
933	{ .name = "pane-border-lines",
934	  .type = OPTIONS_TABLE_CHOICE,
935	  .scope = OPTIONS_TABLE_WINDOW,
936	  .choices = options_table_pane_lines_list,
937	  .default_num = PANE_LINES_SINGLE,
938	  .text = "Type of the pane type lines."
939	},
940
941	{ .name = "pane-border-status",
942	  .type = OPTIONS_TABLE_CHOICE,
943	  .scope = OPTIONS_TABLE_WINDOW,
944	  .choices = options_table_pane_status_list,
945	  .default_num = PANE_STATUS_OFF,
946	  .text = "Position of the pane status lines."
947	},
948
949	{ .name = "pane-border-style",
950	  .type = OPTIONS_TABLE_STRING,
951	  .scope = OPTIONS_TABLE_WINDOW,
952	  .default_str = "default",
953	  .flags = OPTIONS_TABLE_IS_STYLE,
954	  .separator = ",",
955	  .text = "Style of the pane status lines."
956	},
957
958	{ .name = "remain-on-exit",
959	  .type = OPTIONS_TABLE_CHOICE,
960	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
961	  .choices = options_table_remain_on_exit_list,
962	  .default_num = 0,
963	  .text = "Whether panes should remain ('on') or be automatically "
964		  "killed ('off' or 'failed') when the program inside exits."
965	},
966
967	{ .name = "synchronize-panes",
968	  .type = OPTIONS_TABLE_FLAG,
969	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
970	  .default_num = 0,
971	  .text = "Whether typing should be sent to all panes simultaneously."
972	},
973
974	{ .name = "window-active-style",
975	  .type = OPTIONS_TABLE_STRING,
976	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
977	  .default_str = "default",
978	  .flags = OPTIONS_TABLE_IS_STYLE,
979	  .separator = ",",
980	  .text = "Default style of the active pane."
981	},
982
983	{ .name = "window-size",
984	  .type = OPTIONS_TABLE_CHOICE,
985	  .scope = OPTIONS_TABLE_WINDOW,
986	  .choices = options_table_window_size_list,
987	  .default_num = WINDOW_SIZE_LATEST,
988	  .text = "How window size is calculated. "
989		  "'latest' uses the size of the most recently used client, "
990		  "'largest' the largest client, 'smallest' the smallest "
991		  "client and 'manual' a size set by the 'resize-window' "
992		  "command."
993	},
994
995	{ .name = "window-style",
996	  .type = OPTIONS_TABLE_STRING,
997	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
998	  .default_str = "default",
999	  .flags = OPTIONS_TABLE_IS_STYLE,
1000	  .separator = ",",
1001	  .text = "Default style of panes that are not the active pane."
1002	},
1003
1004	{ .name = "window-status-activity-style",
1005	  .type = OPTIONS_TABLE_STRING,
1006	  .scope = OPTIONS_TABLE_WINDOW,
1007	  .default_str = "reverse",
1008	  .flags = OPTIONS_TABLE_IS_STYLE,
1009	  .separator = ",",
1010	  .text = "Style of windows in the status line with an activity alert."
1011	},
1012
1013	{ .name = "window-status-bell-style",
1014	  .type = OPTIONS_TABLE_STRING,
1015	  .scope = OPTIONS_TABLE_WINDOW,
1016	  .default_str = "reverse",
1017	  .flags = OPTIONS_TABLE_IS_STYLE,
1018	  .separator = ",",
1019	  .text = "Style of windows in the status line with a bell alert."
1020	},
1021
1022	{ .name = "window-status-current-format",
1023	  .type = OPTIONS_TABLE_STRING,
1024	  .scope = OPTIONS_TABLE_WINDOW,
1025	  .default_str = "#I:#W#{?window_flags,#{window_flags}, }",
1026	  .text = "Format of the current window in the status line."
1027	},
1028
1029	{ .name = "window-status-current-style",
1030	  .type = OPTIONS_TABLE_STRING,
1031	  .scope = OPTIONS_TABLE_WINDOW,
1032	  .default_str = "default",
1033	  .flags = OPTIONS_TABLE_IS_STYLE,
1034	  .separator = ",",
1035	  .text = "Style of the current window in the status line."
1036	},
1037
1038	{ .name = "window-status-format",
1039	  .type = OPTIONS_TABLE_STRING,
1040	  .scope = OPTIONS_TABLE_WINDOW,
1041	  .default_str = "#I:#W#{?window_flags,#{window_flags}, }",
1042	  .text = "Format of windows in the status line, except the current "
1043		  "window."
1044	},
1045
1046	{ .name = "window-status-last-style",
1047	  .type = OPTIONS_TABLE_STRING,
1048	  .scope = OPTIONS_TABLE_WINDOW,
1049	  .default_str = "default",
1050	  .flags = OPTIONS_TABLE_IS_STYLE,
1051	  .separator = ",",
1052	  .text = "Style of the last window in the status line."
1053	},
1054
1055	{ .name = "window-status-separator",
1056	  .type = OPTIONS_TABLE_STRING,
1057	  .scope = OPTIONS_TABLE_WINDOW,
1058	  .default_str = " ",
1059	  .text = "Separator between windows in the status line."
1060	},
1061
1062	{ .name = "window-status-style",
1063	  .type = OPTIONS_TABLE_STRING,
1064	  .scope = OPTIONS_TABLE_WINDOW,
1065	  .default_str = "default",
1066	  .flags = OPTIONS_TABLE_IS_STYLE,
1067	  .separator = ",",
1068	  .text = "Style of windows in the status line, except the current and "
1069		  "last windows."
1070	},
1071
1072	{ .name = "wrap-search",
1073	  .type = OPTIONS_TABLE_FLAG,
1074	  .scope = OPTIONS_TABLE_WINDOW,
1075	  .default_num = 1,
1076	  .text = "Whether searching in copy mode should wrap at the top or "
1077		  "bottom."
1078	},
1079
1080	{ .name = "xterm-keys", /* no longer used */
1081	  .type = OPTIONS_TABLE_FLAG,
1082	  .scope = OPTIONS_TABLE_WINDOW,
1083	  .default_num = 1,
1084	  .text = "Whether xterm-style function key sequences should be sent. "
1085	          "This option is no longer used."
1086	},
1087
1088	/* Hook options. */
1089	OPTIONS_TABLE_HOOK("after-bind-key", ""),
1090	OPTIONS_TABLE_HOOK("after-capture-pane", ""),
1091	OPTIONS_TABLE_HOOK("after-copy-mode", ""),
1092	OPTIONS_TABLE_HOOK("after-display-message", ""),
1093	OPTIONS_TABLE_HOOK("after-display-panes", ""),
1094	OPTIONS_TABLE_HOOK("after-kill-pane", ""),
1095	OPTIONS_TABLE_HOOK("after-list-buffers", ""),
1096	OPTIONS_TABLE_HOOK("after-list-clients", ""),
1097	OPTIONS_TABLE_HOOK("after-list-keys", ""),
1098	OPTIONS_TABLE_HOOK("after-list-panes", ""),
1099	OPTIONS_TABLE_HOOK("after-list-sessions", ""),
1100	OPTIONS_TABLE_HOOK("after-list-windows", ""),
1101	OPTIONS_TABLE_HOOK("after-load-buffer", ""),
1102	OPTIONS_TABLE_HOOK("after-lock-server", ""),
1103	OPTIONS_TABLE_HOOK("after-new-session", ""),
1104	OPTIONS_TABLE_HOOK("after-new-window", ""),
1105	OPTIONS_TABLE_HOOK("after-paste-buffer", ""),
1106	OPTIONS_TABLE_HOOK("after-pipe-pane", ""),
1107	OPTIONS_TABLE_HOOK("after-queue", ""),
1108	OPTIONS_TABLE_HOOK("after-refresh-client", ""),
1109	OPTIONS_TABLE_HOOK("after-rename-session", ""),
1110	OPTIONS_TABLE_HOOK("after-rename-window", ""),
1111	OPTIONS_TABLE_HOOK("after-resize-pane", ""),
1112	OPTIONS_TABLE_HOOK("after-resize-window", ""),
1113	OPTIONS_TABLE_HOOK("after-save-buffer", ""),
1114	OPTIONS_TABLE_HOOK("after-select-layout", ""),
1115	OPTIONS_TABLE_HOOK("after-select-pane", ""),
1116	OPTIONS_TABLE_HOOK("after-select-window", ""),
1117	OPTIONS_TABLE_HOOK("after-send-keys", ""),
1118	OPTIONS_TABLE_HOOK("after-set-buffer", ""),
1119	OPTIONS_TABLE_HOOK("after-set-environment", ""),
1120	OPTIONS_TABLE_HOOK("after-set-hook", ""),
1121	OPTIONS_TABLE_HOOK("after-set-option", ""),
1122	OPTIONS_TABLE_HOOK("after-show-environment", ""),
1123	OPTIONS_TABLE_HOOK("after-show-messages", ""),
1124	OPTIONS_TABLE_HOOK("after-show-options", ""),
1125	OPTIONS_TABLE_HOOK("after-split-window", ""),
1126	OPTIONS_TABLE_HOOK("after-unbind-key", ""),
1127	OPTIONS_TABLE_HOOK("alert-activity", ""),
1128	OPTIONS_TABLE_HOOK("alert-bell", ""),
1129	OPTIONS_TABLE_HOOK("alert-silence", ""),
1130	OPTIONS_TABLE_HOOK("client-attached", ""),
1131	OPTIONS_TABLE_HOOK("client-detached", ""),
1132	OPTIONS_TABLE_HOOK("client-resized", ""),
1133	OPTIONS_TABLE_HOOK("client-session-changed", ""),
1134	OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
1135	OPTIONS_TABLE_PANE_HOOK("pane-exited", ""),
1136	OPTIONS_TABLE_PANE_HOOK("pane-focus-in", ""),
1137	OPTIONS_TABLE_PANE_HOOK("pane-focus-out", ""),
1138	OPTIONS_TABLE_PANE_HOOK("pane-mode-changed", ""),
1139	OPTIONS_TABLE_PANE_HOOK("pane-set-clipboard", ""),
1140	OPTIONS_TABLE_PANE_HOOK("pane-title-changed", ""),
1141	OPTIONS_TABLE_HOOK("session-closed", ""),
1142	OPTIONS_TABLE_HOOK("session-created", ""),
1143	OPTIONS_TABLE_HOOK("session-renamed", ""),
1144	OPTIONS_TABLE_HOOK("session-window-changed", ""),
1145	OPTIONS_TABLE_WINDOW_HOOK("window-layout-changed", ""),
1146	OPTIONS_TABLE_WINDOW_HOOK("window-linked", ""),
1147	OPTIONS_TABLE_WINDOW_HOOK("window-pane-changed", ""),
1148	OPTIONS_TABLE_WINDOW_HOOK("window-renamed", ""),
1149	OPTIONS_TABLE_WINDOW_HOOK("window-unlinked", ""),
1150
1151	{ .name = NULL }
1152};
1153