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