Annotation of src/usr.bin/tmux/options-table.c, Revision 1.72
1.72 ! nicm 1: /* $OpenBSD: options-table.c,v 1.71 2016/01/19 15:59:12 nicm Exp $ */
1.1 nicm 2:
3: /*
1.71 nicm 4: * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
1.1 nicm 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
1.49 nicm 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.
1.1 nicm 33: */
34:
35: /* Choice option type lists. */
36: const char *options_table_mode_keys_list[] = {
37: "emacs", "vi", NULL
38: };
39: const char *options_table_clock_mode_style_list[] = {
40: "12", "24", NULL
41: };
42: const char *options_table_status_keys_list[] = {
43: "emacs", "vi", NULL
44: };
45: const char *options_table_status_justify_list[] = {
46: "left", "centre", "right", NULL
47: };
1.20 nicm 48: const char *options_table_status_position_list[] = {
49: "top", "bottom", NULL
50: };
1.1 nicm 51: const char *options_table_bell_action_list[] = {
1.59 nicm 52: "none", "any", "current", "other", NULL
1.1 nicm 53: };
1.72 ! nicm 54: const char *options_table_pane_status_list[] = {
! 55: "off", "top", "bottom", NULL
! 56: };
1.1 nicm 57:
58: /* Server options. */
1.67 nicm 59: const struct options_table_entry options_table[] = {
1.1 nicm 60: { .name = "buffer-limit",
61: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 62: .scope = OPTIONS_TABLE_SERVER,
1.1 nicm 63: .minimum = 1,
64: .maximum = INT_MAX,
1.4 nicm 65: .default_num = 20
1.1 nicm 66: },
67:
1.56 nicm 68: { .name = "default-terminal",
69: .type = OPTIONS_TABLE_STRING,
1.67 nicm 70: .scope = OPTIONS_TABLE_SERVER,
1.56 nicm 71: .default_str = "screen"
72: },
73:
1.1 nicm 74: { .name = "escape-time",
75: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 76: .scope = OPTIONS_TABLE_SERVER,
1.1 nicm 77: .minimum = 0,
78: .maximum = INT_MAX,
79: .default_num = 500
80: },
81:
82: { .name = "exit-unattached",
1.38 nicm 83: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 84: .scope = OPTIONS_TABLE_SERVER,
1.38 nicm 85: .default_num = 0
86: },
87:
88: { .name = "focus-events",
1.1 nicm 89: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 90: .scope = OPTIONS_TABLE_SERVER,
1.1 nicm 91: .default_num = 0
1.61 nicm 92: },
93:
94: { .name = "history-file",
95: .type = OPTIONS_TABLE_STRING,
1.67 nicm 96: .scope = OPTIONS_TABLE_SERVER,
1.65 nicm 97: .default_str = ""
1.1 nicm 98: },
99:
1.46 nicm 100: { .name = "message-limit",
101: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 102: .scope = OPTIONS_TABLE_SERVER,
1.46 nicm 103: .minimum = 0,
104: .maximum = INT_MAX,
105: .default_num = 100
106: },
107:
1.1 nicm 108: { .name = "quiet",
109: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 110: .scope = OPTIONS_TABLE_SERVER,
1.48 nicm 111: .default_num = 0
1.1 nicm 112: },
113:
1.8 nicm 114: { .name = "set-clipboard",
115: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 116: .scope = OPTIONS_TABLE_SERVER,
1.8 nicm 117: .default_num = 1
118: },
119:
1.45 nicm 120: { .name = "terminal-overrides",
121: .type = OPTIONS_TABLE_STRING,
1.67 nicm 122: .scope = OPTIONS_TABLE_SERVER,
1.63 nicm 123: .default_str = "xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
1.45 nicm 124: ":Cs=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
125: ":Ss=\\E[%p1%d q:Se=\\E[2 q,screen*:XT"
126: },
127:
1.31 nicm 128: { .name = "assume-paste-time",
129: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 130: .scope = OPTIONS_TABLE_SESSION,
1.31 nicm 131: .minimum = 0,
132: .maximum = INT_MAX,
133: .default_num = 1,
134: },
135:
1.1 nicm 136: { .name = "base-index",
137: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 138: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 139: .minimum = 0,
140: .maximum = INT_MAX,
141: .default_num = 0
142: },
143:
144: { .name = "bell-action",
145: .type = OPTIONS_TABLE_CHOICE,
1.67 nicm 146: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 147: .choices = options_table_bell_action_list,
148: .default_num = BELL_ANY
1.11 nicm 149: },
150:
151: { .name = "bell-on-alert",
152: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 153: .scope = OPTIONS_TABLE_SESSION,
1.11 nicm 154: .default_num = 0
1.1 nicm 155: },
156:
157: { .name = "default-command",
158: .type = OPTIONS_TABLE_STRING,
1.67 nicm 159: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 160: .default_str = ""
161: },
162:
163: { .name = "default-shell",
164: .type = OPTIONS_TABLE_STRING,
1.67 nicm 165: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 166: .default_str = _PATH_BSHELL
167: },
168:
169: { .name = "destroy-unattached",
170: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 171: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 172: .default_num = 0
173: },
174:
175: { .name = "detach-on-destroy",
176: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 177: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 178: .default_num = 1
179: },
180:
181: { .name = "display-panes-active-colour",
182: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 183: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 184: .default_num = 1
185: },
186:
187: { .name = "display-panes-colour",
188: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 189: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 190: .default_num = 4
191: },
192:
193: { .name = "display-panes-time",
194: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 195: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 196: .minimum = 1,
197: .maximum = INT_MAX,
198: .default_num = 1000
199: },
200:
201: { .name = "display-time",
202: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 203: .scope = OPTIONS_TABLE_SESSION,
1.68 tim 204: .minimum = 0,
1.1 nicm 205: .maximum = INT_MAX,
206: .default_num = 750
207: },
208:
209: { .name = "history-limit",
210: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 211: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 212: .minimum = 0,
1.3 nicm 213: .maximum = INT_MAX,
1.1 nicm 214: .default_num = 2000
1.70 nicm 215: },
216:
217: { .name = "key-table",
218: .type = OPTIONS_TABLE_STRING,
219: .scope = OPTIONS_TABLE_SESSION,
220: .default_str = "root"
1.1 nicm 221: },
222:
223: { .name = "lock-after-time",
224: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 225: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 226: .minimum = 0,
227: .maximum = INT_MAX,
228: .default_num = 0
229: },
230:
231: { .name = "lock-command",
232: .type = OPTIONS_TABLE_STRING,
1.67 nicm 233: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 234: .default_str = "lock -np"
235: },
236:
237: { .name = "message-attr",
238: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 239: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 240: .default_num = 0,
241: .style = "message-style"
1.1 nicm 242: },
243:
244: { .name = "message-bg",
1.15 nicm 245: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 246: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 247: .default_num = 3,
248: .style = "message-style"
1.15 nicm 249: },
250:
251: { .name = "message-command-attr",
252: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 253: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 254: .default_num = 0,
255: .style = "message-command-style"
1.15 nicm 256: },
257:
258: { .name = "message-command-bg",
259: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 260: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 261: .default_num = 0,
262: .style = "message-command-style"
1.15 nicm 263: },
264:
265: { .name = "message-command-fg",
1.1 nicm 266: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 267: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 268: .default_num = 3,
269: .style = "message-command-style"
270: },
271:
272: { .name = "message-command-style",
273: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 274: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 275: .default_str = "bg=black,fg=yellow"
1.1 nicm 276: },
277:
278: { .name = "message-fg",
279: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 280: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 281: .default_num = 0,
282: .style = "message-style"
1.7 nicm 283: },
284:
1.43 nicm 285: { .name = "message-style",
286: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 287: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 288: .default_str = "bg=yellow,fg=black"
289: },
290:
1.55 nicm 291: { .name = "mouse",
1.1 nicm 292: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 293: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 294: .default_num = 0
295: },
296:
297: { .name = "prefix",
1.19 nicm 298: .type = OPTIONS_TABLE_KEY,
1.67 nicm 299: .scope = OPTIONS_TABLE_SESSION,
1.19 nicm 300: .default_num = '\002',
301: },
302:
303: { .name = "prefix2",
304: .type = OPTIONS_TABLE_KEY,
1.67 nicm 305: .scope = OPTIONS_TABLE_SESSION,
1.19 nicm 306: .default_num = KEYC_NONE,
1.29 nicm 307: },
308:
309: { .name = "renumber-windows",
310: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 311: .scope = OPTIONS_TABLE_SESSION,
1.29 nicm 312: .default_num = 0
1.1 nicm 313: },
314:
315: { .name = "repeat-time",
316: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 317: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 318: .minimum = 0,
319: .maximum = SHRT_MAX,
320: .default_num = 500
321: },
322:
323: { .name = "set-remain-on-exit",
324: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 325: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 326: .default_num = 0
327: },
328:
329: { .name = "set-titles",
330: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 331: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 332: .default_num = 0
333: },
334:
335: { .name = "set-titles-string",
336: .type = OPTIONS_TABLE_STRING,
1.67 nicm 337: .scope = OPTIONS_TABLE_SESSION,
1.60 nicm 338: .default_str = "#S:#I:#W - \"#T\" #{session_alerts}"
1.1 nicm 339: },
340:
341: { .name = "status",
342: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 343: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 344: .default_num = 1
345: },
346:
347: { .name = "status-attr",
348: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 349: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 350: .default_num = 0,
351: .style = "status-style"
1.1 nicm 352: },
353:
354: { .name = "status-bg",
355: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 356: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 357: .default_num = 2,
358: .style = "status-style"
1.1 nicm 359: },
360:
361: { .name = "status-fg",
362: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 363: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 364: .default_num = 0,
365: .style = "status-style"
1.1 nicm 366: },
367:
368: { .name = "status-interval",
369: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 370: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 371: .minimum = 0,
372: .maximum = INT_MAX,
373: .default_num = 15
374: },
375:
376: { .name = "status-justify",
377: .type = OPTIONS_TABLE_CHOICE,
1.67 nicm 378: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 379: .choices = options_table_status_justify_list,
380: .default_num = 0
381: },
382:
383: { .name = "status-keys",
384: .type = OPTIONS_TABLE_CHOICE,
1.67 nicm 385: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 386: .choices = options_table_status_keys_list,
387: .default_num = MODEKEY_EMACS
388: },
389:
390: { .name = "status-left",
391: .type = OPTIONS_TABLE_STRING,
1.67 nicm 392: .scope = OPTIONS_TABLE_SESSION,
1.51 nicm 393: .default_str = "[#S] "
1.1 nicm 394: },
395:
396: { .name = "status-left-attr",
397: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 398: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 399: .default_num = 0,
400: .style = "status-left-style"
1.1 nicm 401: },
402:
403: { .name = "status-left-bg",
404: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 405: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 406: .default_num = 8,
407: .style = "status-left-style"
1.1 nicm 408: },
409:
410: { .name = "status-left-fg",
411: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 412: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 413: .default_num = 8,
414: .style = "status-left-style"
1.1 nicm 415: },
416:
417: { .name = "status-left-length",
418: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 419: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 420: .minimum = 0,
421: .maximum = SHRT_MAX,
422: .default_num = 10
1.20 nicm 423: },
424:
1.43 nicm 425: { .name = "status-left-style",
426: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 427: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 428: .default_str = "default"
429: },
430:
1.20 nicm 431: { .name = "status-position",
432: .type = OPTIONS_TABLE_CHOICE,
1.67 nicm 433: .scope = OPTIONS_TABLE_SESSION,
1.20 nicm 434: .choices = options_table_status_position_list,
435: .default_num = 1
1.1 nicm 436: },
437:
438: { .name = "status-right",
439: .type = OPTIONS_TABLE_STRING,
1.67 nicm 440: .scope = OPTIONS_TABLE_SESSION,
1.52 sthen 441: .default_str = " \"#{=21:pane_title}\" %H:%M %d-%b-%y"
1.1 nicm 442: },
443:
444: { .name = "status-right-attr",
445: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 446: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 447: .default_num = 0,
448: .style = "status-right-style"
1.1 nicm 449: },
450:
451: { .name = "status-right-bg",
452: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 453: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 454: .default_num = 8,
455: .style = "status-right-style"
1.1 nicm 456: },
457:
458: { .name = "status-right-fg",
459: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 460: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 461: .default_num = 8,
462: .style = "status-right-style"
1.1 nicm 463: },
464:
465: { .name = "status-right-length",
466: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 467: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 468: .minimum = 0,
469: .maximum = SHRT_MAX,
470: .default_num = 40
471: },
472:
1.43 nicm 473: { .name = "status-right-style",
474: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 475: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 476: .default_str = "default"
477: },
478:
479: { .name = "status-style",
480: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 481: .scope = OPTIONS_TABLE_SESSION,
1.43 nicm 482: .default_str = "bg=green,fg=black"
483: },
484:
1.1 nicm 485: { .name = "update-environment",
486: .type = OPTIONS_TABLE_STRING,
1.67 nicm 487: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 488: .default_str = "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID "
1.9 nicm 489: "SSH_CONNECTION WINDOWID XAUTHORITY"
1.1 nicm 490:
491: },
492:
493: { .name = "visual-activity",
494: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 495: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 496: .default_num = 0
497: },
498:
499: { .name = "visual-bell",
500: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 501: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 502: .default_num = 0
503: },
504:
505: { .name = "visual-silence",
506: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 507: .scope = OPTIONS_TABLE_SESSION,
1.1 nicm 508: .default_num = 0
509: },
510:
1.16 nicm 511: { .name = "word-separators",
512: .type = OPTIONS_TABLE_STRING,
1.67 nicm 513: .scope = OPTIONS_TABLE_SESSION,
1.16 nicm 514: .default_str = " -_@"
515: },
516:
1.1 nicm 517: { .name = "aggressive-resize",
518: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 519: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 520: .default_num = 0
1.17 nicm 521: },
522:
523: { .name = "allow-rename",
524: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 525: .scope = OPTIONS_TABLE_WINDOW,
1.17 nicm 526: .default_num = 1
1.1 nicm 527: },
528:
529: { .name = "alternate-screen",
530: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 531: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 532: .default_num = 1
533: },
534:
535: { .name = "automatic-rename",
536: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 537: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 538: .default_num = 1
1.41 nicm 539: },
540:
541: { .name = "automatic-rename-format",
542: .type = OPTIONS_TABLE_STRING,
1.67 nicm 543: .scope = OPTIONS_TABLE_WINDOW,
1.50 nicm 544: .default_str = "#{?pane_in_mode,[tmux],#{pane_current_command}}"
545: "#{?pane_dead,[dead],}"
1.1 nicm 546: },
547:
548: { .name = "clock-mode-colour",
549: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 550: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 551: .default_num = 4
552: },
553:
554: { .name = "clock-mode-style",
555: .type = OPTIONS_TABLE_CHOICE,
1.67 nicm 556: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 557: .choices = options_table_clock_mode_style_list,
558: .default_num = 1
559: },
560:
561: { .name = "force-height",
562: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 563: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 564: .minimum = 0,
565: .maximum = INT_MAX,
566: .default_num = 0
567: },
568:
569: { .name = "force-width",
570: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 571: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 572: .minimum = 0,
573: .maximum = INT_MAX,
574: .default_num = 0
575: },
576:
577: { .name = "main-pane-height",
578: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 579: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 580: .minimum = 1,
581: .maximum = INT_MAX,
582: .default_num = 24
583: },
584:
585: { .name = "main-pane-width",
586: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 587: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 588: .minimum = 1,
589: .maximum = INT_MAX,
590: .default_num = 80
591: },
592:
593: { .name = "mode-attr",
594: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 595: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 596: .default_num = 0,
597: .style = "mode-style"
1.1 nicm 598: },
599:
600: { .name = "mode-bg",
601: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 602: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 603: .default_num = 3,
604: .style = "mode-style"
1.1 nicm 605: },
606:
607: { .name = "mode-fg",
608: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 609: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 610: .default_num = 0,
611: .style = "mode-style"
1.1 nicm 612: },
613:
614: { .name = "mode-keys",
615: .type = OPTIONS_TABLE_CHOICE,
1.67 nicm 616: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 617: .choices = options_table_mode_keys_list,
618: .default_num = MODEKEY_EMACS
619: },
620:
1.43 nicm 621: { .name = "mode-style",
622: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 623: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 624: .default_str = "bg=yellow,fg=black"
625: },
626:
1.1 nicm 627: { .name = "monitor-activity",
628: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 629: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 630: .default_num = 0
631: },
632:
633: { .name = "monitor-silence",
634: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 635: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 636: .minimum = 0,
637: .maximum = INT_MAX,
638: .default_num = 0
639: },
640:
641: { .name = "other-pane-height",
642: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 643: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 644: .minimum = 0,
645: .maximum = INT_MAX,
646: .default_num = 0
647: },
648:
649: { .name = "other-pane-width",
650: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 651: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 652: .minimum = 0,
653: .maximum = INT_MAX,
1.13 nicm 654: .default_num = 0
655: },
656:
1.53 nicm 657: { .name = "pane-active-border-bg",
658: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 659: .scope = OPTIONS_TABLE_WINDOW,
1.53 nicm 660: .default_num = 8,
661: .style = "pane-active-border-style"
662: },
663:
664: { .name = "pane-active-border-fg",
665: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 666: .scope = OPTIONS_TABLE_WINDOW,
1.53 nicm 667: .default_num = 2,
668: .style = "pane-active-border-style"
669: },
670:
671: { .name = "pane-active-border-style",
672: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 673: .scope = OPTIONS_TABLE_WINDOW,
1.53 nicm 674: .default_str = "fg=green"
675: },
676:
1.13 nicm 677: { .name = "pane-base-index",
678: .type = OPTIONS_TABLE_NUMBER,
1.67 nicm 679: .scope = OPTIONS_TABLE_WINDOW,
1.13 nicm 680: .minimum = 0,
681: .maximum = USHRT_MAX,
1.22 nicm 682: .default_num = 0
1.53 nicm 683: },
684:
685: { .name = "pane-border-bg",
686: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 687: .scope = OPTIONS_TABLE_WINDOW,
1.53 nicm 688: .default_num = 8,
689: .style = "pane-border-style"
690: },
691:
692: { .name = "pane-border-fg",
693: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 694: .scope = OPTIONS_TABLE_WINDOW,
1.53 nicm 695: .default_num = 8,
696: .style = "pane-border-style"
1.72 ! nicm 697: },
! 698:
! 699: { .name = "pane-border-format",
! 700: .type = OPTIONS_TABLE_STRING,
! 701: .scope = OPTIONS_TABLE_WINDOW,
! 702: .default_str = "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\""
! 703: },
! 704:
! 705: { .name = "pane-border-status",
! 706: .type = OPTIONS_TABLE_CHOICE,
! 707: .scope = OPTIONS_TABLE_WINDOW,
! 708: .choices = options_table_pane_status_list,
! 709: .default_num = 0
1.53 nicm 710: },
711:
712: { .name = "pane-border-style",
713: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 714: .scope = OPTIONS_TABLE_WINDOW,
1.53 nicm 715: .default_str = "default"
1.22 nicm 716: },
717:
1.1 nicm 718: { .name = "remain-on-exit",
719: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 720: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 721: .default_num = 0
722: },
723:
724: { .name = "synchronize-panes",
725: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 726: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 727: .default_num = 0
1.54 nicm 728: },
729:
730: { .name = "window-active-style",
731: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 732: .scope = OPTIONS_TABLE_WINDOW,
1.54 nicm 733: .default_str = "default"
734: },
735:
736: { .name = "window-style",
737: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 738: .scope = OPTIONS_TABLE_WINDOW,
1.54 nicm 739: .default_str = "default"
1.1 nicm 740: },
741:
1.21 nicm 742: { .name = "window-status-activity-attr",
1.1 nicm 743: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 744: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 745: .default_num = GRID_ATTR_REVERSE,
746: .style = "window-status-activity-style"
1.1 nicm 747: },
748:
1.21 nicm 749: { .name = "window-status-activity-bg",
1.1 nicm 750: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 751: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 752: .default_num = 8,
753: .style = "window-status-activity-style"
1.1 nicm 754: },
755:
1.21 nicm 756: { .name = "window-status-activity-fg",
1.18 nicm 757: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 758: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 759: .default_num = 8,
760: .style = "window-status-activity-style"
761: },
762:
763: { .name = "window-status-activity-style",
764: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 765: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 766: .default_str = "reverse"
767: },
768:
769: { .name = "window-status-attr",
770: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 771: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 772: .default_num = 0,
773: .style = "window-status-style"
1.18 nicm 774: },
775:
1.21 nicm 776: { .name = "window-status-bell-attr",
1.18 nicm 777: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 778: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 779: .default_num = GRID_ATTR_REVERSE,
780: .style = "window-status-bell-style"
1.18 nicm 781: },
782:
1.21 nicm 783: { .name = "window-status-bell-bg",
1.18 nicm 784: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 785: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 786: .default_num = 8,
787: .style = "window-status-bell-style"
1.18 nicm 788: },
789:
1.21 nicm 790: { .name = "window-status-bell-fg",
1.18 nicm 791: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 792: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 793: .default_num = 8,
794: .style = "window-status-bell-style"
795: },
796:
797: { .name = "window-status-bell-style",
798: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 799: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 800: .default_str = "reverse"
801: },
802:
803: { .name = "window-status-bg",
804: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 805: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 806: .default_num = 8,
807: .style = "window-status-style"
1.1 nicm 808: },
809:
810: { .name = "window-status-current-attr",
811: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 812: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 813: .default_num = 0,
814: .style = "window-status-current-style"
1.1 nicm 815: },
816:
817: { .name = "window-status-current-bg",
818: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 819: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 820: .default_num = 8,
821: .style = "window-status-current-style"
1.1 nicm 822: },
823:
824: { .name = "window-status-current-fg",
825: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 826: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 827: .default_num = 8,
828: .style = "window-status-current-style"
1.1 nicm 829: },
830:
831: { .name = "window-status-current-format",
832: .type = OPTIONS_TABLE_STRING,
1.67 nicm 833: .scope = OPTIONS_TABLE_WINDOW,
1.57 nicm 834: .default_str = "#I:#W#{?window_flags,#{window_flags}, }"
1.30 nicm 835: },
836:
1.43 nicm 837: { .name = "window-status-current-style",
838: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 839: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 840: .default_str = "default"
841: },
842:
843: { .name = "window-status-fg",
844: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 845: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 846: .default_num = 8,
847: .style = "window-status-style"
848: },
849:
850: { .name = "window-status-format",
851: .type = OPTIONS_TABLE_STRING,
1.67 nicm 852: .scope = OPTIONS_TABLE_WINDOW,
1.57 nicm 853: .default_str = "#I:#W#{?window_flags,#{window_flags}, }"
1.43 nicm 854: },
855:
1.30 nicm 856: { .name = "window-status-last-attr",
857: .type = OPTIONS_TABLE_ATTRIBUTES,
1.67 nicm 858: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 859: .default_num = 0,
860: .style = "window-status-last-style"
1.30 nicm 861: },
862:
863: { .name = "window-status-last-bg",
864: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 865: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 866: .default_num = 8,
867: .style = "window-status-last-style"
1.30 nicm 868: },
869:
870: { .name = "window-status-last-fg",
871: .type = OPTIONS_TABLE_COLOUR,
1.67 nicm 872: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 873: .default_num = 8,
874: .style = "window-status-last-style"
1.1 nicm 875: },
876:
1.43 nicm 877: { .name = "window-status-last-style",
878: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 879: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 880: .default_str = "default"
1.1 nicm 881: },
882:
1.43 nicm 883: { .name = "window-status-separator",
1.1 nicm 884: .type = OPTIONS_TABLE_STRING,
1.67 nicm 885: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 886: .default_str = " "
1.28 nicm 887: },
888:
1.43 nicm 889: { .name = "window-status-style",
890: .type = OPTIONS_TABLE_STYLE,
1.67 nicm 891: .scope = OPTIONS_TABLE_WINDOW,
1.43 nicm 892: .default_str = "default"
1.24 nicm 893: },
894:
895: { .name = "wrap-search",
896: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 897: .scope = OPTIONS_TABLE_WINDOW,
1.24 nicm 898: .default_num = 1
1.1 nicm 899: },
900:
901: { .name = "xterm-keys",
902: .type = OPTIONS_TABLE_FLAG,
1.67 nicm 903: .scope = OPTIONS_TABLE_WINDOW,
1.1 nicm 904: .default_num = 0
905: },
906:
907: { .name = NULL }
908: };
909:
910: /* Populate an options tree from a table. */
911: void
1.67 nicm 912: options_table_populate_tree(enum options_table_scope scope, struct options *oo)
1.1 nicm 913: {
914: const struct options_table_entry *oe;
915:
1.67 nicm 916: for (oe = options_table; oe->name != NULL; oe++) {
1.69 nicm 917: if (oe->scope == OPTIONS_TABLE_NONE)
918: fatalx("no scope for %s", oe->name);
1.67 nicm 919: if (oe->scope != scope)
920: continue;
1.43 nicm 921: switch (oe->type) {
922: case OPTIONS_TABLE_STRING:
1.1 nicm 923: options_set_string(oo, oe->name, "%s", oe->default_str);
1.43 nicm 924: break;
925: case OPTIONS_TABLE_STYLE:
1.44 nicm 926: options_set_style(oo, oe->name, oe->default_str, 0);
1.43 nicm 927: break;
928: default:
1.1 nicm 929: options_set_number(oo, oe->name, oe->default_num);
1.43 nicm 930: break;
931: }
1.1 nicm 932: }
933: }
934:
935: /* Print an option using its type from the table. */
936: const char *
1.33 nicm 937: options_table_print_entry(const struct options_table_entry *oe,
938: struct options_entry *o, int no_quotes)
1.1 nicm 939: {
1.19 nicm 940: static char out[BUFSIZ];
941: const char *s;
1.1 nicm 942:
943: *out = '\0';
944: switch (oe->type) {
945: case OPTIONS_TABLE_STRING:
1.33 nicm 946: if (no_quotes)
947: xsnprintf(out, sizeof out, "%s", o->str);
948: else
949: xsnprintf(out, sizeof out, "\"%s\"", o->str);
1.1 nicm 950: break;
951: case OPTIONS_TABLE_NUMBER:
952: xsnprintf(out, sizeof out, "%lld", o->num);
953: break;
1.19 nicm 954: case OPTIONS_TABLE_KEY:
1.33 nicm 955: xsnprintf(out, sizeof out, "%s",
956: key_string_lookup_key(o->num));
1.1 nicm 957: break;
958: case OPTIONS_TABLE_COLOUR:
959: s = colour_tostring(o->num);
960: xsnprintf(out, sizeof out, "%s", s);
961: break;
962: case OPTIONS_TABLE_ATTRIBUTES:
963: s = attributes_tostring(o->num);
964: xsnprintf(out, sizeof out, "%s", s);
965: break;
966: case OPTIONS_TABLE_FLAG:
967: if (o->num)
968: strlcpy(out, "on", sizeof out);
969: else
970: strlcpy(out, "off", sizeof out);
971: break;
972: case OPTIONS_TABLE_CHOICE:
973: s = oe->choices[o->num];
1.43 nicm 974: xsnprintf(out, sizeof out, "%s", s);
975: break;
976: case OPTIONS_TABLE_STYLE:
977: s = style_tostring(&o->style);
1.1 nicm 978: xsnprintf(out, sizeof out, "%s", s);
979: break;
980: }
981: return (out);
1.22 nicm 982: }
983:
984: /* Find an option. */
985: int
1.67 nicm 986: options_table_find(const char *optstr, const struct options_table_entry **oe)
1.22 nicm 987: {
988: const struct options_table_entry *oe_loop;
989:
1.67 nicm 990: for (oe_loop = options_table; oe_loop->name != NULL; oe_loop++) {
991: if (strncmp(oe_loop->name, optstr, strlen(optstr)) != 0)
992: continue;
993:
994: /* If already found, ambiguous. */
995: if (*oe != NULL)
996: return (-1);
997: *oe = oe_loop;
998:
999: /* Bail now if an exact match. */
1000: if (strcmp(oe_loop->name, optstr) == 0)
1001: break;
1.22 nicm 1002: }
1003: return (0);
1.1 nicm 1004: }