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