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