This repository was archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathhterm_preference_manager.js
870 lines (787 loc) · 32.5 KB
/
hterm_preference_manager.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
/**
* PreferenceManager subclass managing global NaSSH preferences.
*
* This is currently just an ordered list of known connection profiles.
*
* @param {string} profileId
* @extends {lib.PreferenceManager}
* @constructor
*/
hterm.PreferenceManager = function(profileId) {
lib.PreferenceManager.call(this, hterm.defaultStorage,
hterm.PreferenceManager.prefix_ + profileId);
Object.entries(hterm.PreferenceManager.defaultPreferences).forEach(
([key, entry]) => {
this.definePreference(key, entry['default']);
});
};
/**
* The storage key prefix to namespace the preferences.
*/
hterm.PreferenceManager.prefix_ = '/hterm/profiles/';
/**
* List all the defined profiles.
*
* @param {!lib.Storage} storage Where to look for profiles.
* @param {function(!Array<string>)} callback Called with the list of profiles.
*/
hterm.PreferenceManager.listProfiles = function(storage, callback) {
storage.getItems(null).then((items) => {
const profiles = {};
for (const key of Object.keys(items)) {
if (key.startsWith(hterm.PreferenceManager.prefix_)) {
// Turn "/hterm/profiles/foo/bar/cow" to "foo/bar/cow".
const subKey = key.slice(hterm.PreferenceManager.prefix_.length);
// Turn "foo/bar/cow" into "foo".
profiles[subKey.split('/', 1)[0]] = true;
}
}
callback(Object.keys(profiles));
});
};
/** @enum {string} */
hterm.PreferenceManager.Categories = {
Keyboard: 'Keyboard',
Appearance: 'Appearance',
CopyPaste: 'CopyPaste',
Sounds: 'Sounds',
Scrolling: 'Scrolling',
Encoding: 'Encoding',
Extensions: 'Extensions',
Miscellaneous: 'Miscellaneous',
};
/**
* List of categories, ordered by display order (top to bottom)
*/
hterm.PreferenceManager.categoryDefinitions = [
{id: hterm.PreferenceManager.Categories.Appearance,
text: 'Appearance (fonts, colors, images)'},
{id: hterm.PreferenceManager.Categories.CopyPaste,
text: 'Copy & Paste'},
{id: hterm.PreferenceManager.Categories.Encoding,
text: 'Encoding'},
{id: hterm.PreferenceManager.Categories.Keyboard,
text: 'Keyboard'},
{id: hterm.PreferenceManager.Categories.Scrolling,
text: 'Scrolling'},
{id: hterm.PreferenceManager.Categories.Sounds,
text: 'Sounds'},
{id: hterm.PreferenceManager.Categories.Extensions,
text: 'Extensions'},
{id: hterm.PreferenceManager.Categories.Miscellaneous,
text: 'Miscellaneous'},
];
/**
* Internal helper to create a default preference object.
*
* @param {string} name The user readable name/title.
* @param {!hterm.PreferenceManager.Categories} category The pref category.
* @param {boolean|number|string|?Object} defaultValue The default pref value.
* @param {string|!Array<string|null>} type The type for this pref (or an array
* for enums).
* @param {string} help The user readable help text.
* @return {!Object} The default pref object.
*/
hterm.PreferenceManager.definePref_ = function(
name, category, defaultValue, type, help) {
return {
'name': name,
'category': category,
'default': defaultValue,
'type': type,
'help': help,
};
};
hterm.PreferenceManager.defaultPreferences = {
'alt-gr-mode': hterm.PreferenceManager.definePref_(
'AltGr key mode',
hterm.PreferenceManager.Categories.Keyboard,
null, [null, 'none', 'ctrl-alt', 'left-alt', 'right-alt'],
`Select an AltGr detection heuristic.\n` +
`\n` +
`'null': Autodetect based on navigator.language:\n` +
` 'en-us' => 'none', else => 'right-alt'\n` +
`'none': Disable any AltGr emulation.\n` +
`'ctrl-alt': Assume Ctrl+Alt means AltGr.\n` +
`'left-alt': Assume left Alt means AltGr.\n` +
`'right-alt': Assume right Alt means AltGr.`,
),
'alt-backspace-is-meta-backspace': hterm.PreferenceManager.definePref_(
'Alt+Backspace is Meta+Backspace',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`If set, undoes the Chrome OS Alt+Backspace->Delete remap, so that ` +
`Alt+Backspace indeed is Alt+Backspace.`,
),
'alt-is-meta': hterm.PreferenceManager.definePref_(
'Treat Alt key as Meta key',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether the Alt key acts as a Meta key or as a distinct Alt key.`,
),
'alt-sends-what': hterm.PreferenceManager.definePref_(
'Alt key modifier handling',
hterm.PreferenceManager.Categories.Keyboard,
'escape', ['escape', '8-bit', 'browser-key'],
`Controls how the Alt key is handled.\n` +
`\n` +
` escape: Send an ESC prefix.\n` +
` 8-bit: Add 128 to the typed character as in xterm.\n` +
` browser-key: Wait for the keypress event and see what the browser\n` +
` says. (This won't work well on platforms where the browser\n` +
` performs a default action for some Alt sequences.)`,
),
'audible-bell-sound': hterm.PreferenceManager.definePref_(
'Alert bell sound (URI)',
hterm.PreferenceManager.Categories.Sounds,
'lib-resource:hterm/audio/bell', 'url',
`URL of the terminal bell sound. Leave it blank for no audible bell.`,
),
'desktop-notification-bell': hterm.PreferenceManager.definePref_(
'Create desktop notifications for alert bells',
hterm.PreferenceManager.Categories.Sounds,
false, 'bool',
`If true, terminal bells in the background will create a Web ` +
`Notification. https://www.w3.org/TR/notifications/\n` +
`\n` +
`Displaying notifications requires permission from the user. When this ` +
`option is set to true, hterm will attempt to ask the user for ` +
`permission if necessary. Browsers might not show this permission ` +
`request if it was not triggered by a user action.\n` +
`\n` +
`Chrome extensions with the "notifications" permission have permission ` +
`to display notifications.`,
),
'background-color': hterm.PreferenceManager.definePref_(
'Background color',
hterm.PreferenceManager.Categories.Appearance,
'rgb(16, 16, 16)', 'color',
`The background color for text with no other color attributes.`,
),
'background-image': hterm.PreferenceManager.definePref_(
'Background image',
hterm.PreferenceManager.Categories.Appearance,
'', 'string',
`CSS value of the background image. Leave it blank for no image.\n` +
`\n` +
`For example:\n` +
` url(https://goo.gl/anedTK)\n` +
` linear-gradient(top bottom, blue, red)`,
),
'background-size': hterm.PreferenceManager.definePref_(
'Background image size',
hterm.PreferenceManager.Categories.Appearance,
'', 'string',
`CSS value of the background image size.`,
),
'background-position': hterm.PreferenceManager.definePref_(
'Background image position',
hterm.PreferenceManager.Categories.Appearance,
'', 'string',
`CSS value of the background image position.\n` +
`\n` +
`For example:\n` +
` 10% 10%\n` +
` center`,
),
'backspace-sends-backspace': hterm.PreferenceManager.definePref_(
'Backspace key behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`If true, the Backspace key will send BS ('\\x08', aka ^H). Otherwise ` +
`the Backspace key will send '\\x7f'.`,
),
'character-map-overrides': hterm.PreferenceManager.definePref_(
'Character map overrides',
hterm.PreferenceManager.Categories.Appearance,
null, 'value',
`This is specified as an object. It is a sparse array, where each ` +
`property is the character set code and the value is an object that is ` +
`a sparse array itself. In that sparse array, each property is the ` +
`received character and the value is the displayed character.\n` +
`\n` +
`For example:\n` +
`{ "0": {\n` +
` "+": "\\u2192",\n` +
` ",": "\\u2190",\n` +
` "-": "\\u2191",\n` +
` ".": "\\u2193",\n` +
` "0": "\\u2588"\n} }`,
),
'close-on-exit': hterm.PreferenceManager.definePref_(
'Close window on exit',
hterm.PreferenceManager.Categories.Miscellaneous,
true, 'bool',
`Whether to close the window when the command finishes executing.`,
),
'cursor-blink': hterm.PreferenceManager.definePref_(
'Cursor blink',
hterm.PreferenceManager.Categories.Appearance,
false, 'bool',
`Whether the text cursor blinks by default. This can be toggled at ` +
`runtime via terminal escape sequences.`,
),
'cursor-blink-cycle': hterm.PreferenceManager.definePref_(
'Cursor blink rate',
hterm.PreferenceManager.Categories.Appearance,
[1000, 500], 'value',
`The text cursor blink rate in milliseconds.\n` +
`\n` +
`A two element array, the first of which is how long the text cursor ` +
`should be on, second is how long it should be off.`,
),
'cursor-shape': hterm.PreferenceManager.definePref_(
'Text cursor shape',
hterm.PreferenceManager.Categories.Appearance,
'BLOCK', ['BLOCK', 'BEAM', 'UNDERLINE'],
`The shape of the visible text cursor. This can be changed at ` +
`runtime via terminal escape sequences.`,
),
'cursor-color': hterm.PreferenceManager.definePref_(
'Text cursor color',
hterm.PreferenceManager.Categories.Appearance,
'rgba(255, 0, 0, 0.5)', 'color',
`The color of the visible text cursor.`,
),
'color-palette-overrides': hterm.PreferenceManager.definePref_(
'Initial color palette',
hterm.PreferenceManager.Categories.Appearance,
null, 'value',
`Override colors in the default palette.\n` +
`\n` +
`This can be specified as an array or an object. If specified as an ` +
`object it is assumed to be a sparse array, where each property ` +
`is a numeric index into the color palette.\n` +
`\n` +
`Values can be specified as almost any CSS color value. This ` +
`includes #RGB, #RRGGBB, rgb(...), rgba(...), and any color names ` +
`that are also part of the standard X11 rgb.txt file.\n` +
`\n` +
`You can use 'null' to specify that the default value should be not ` +
`be changed. This is useful for skipping a small number of indices ` +
`when the value is specified as an array.\n` +
`\n` +
`For example, these both set color index 1 to blue:\n` +
` {1: "#0000ff"}\n` +
` [null, "#0000ff"]`,
),
'copy-on-select': hterm.PreferenceManager.definePref_(
'Automatically copy selected content',
hterm.PreferenceManager.Categories.CopyPaste,
true, 'bool',
`Automatically copy mouse selection to the clipboard.`,
),
'use-default-window-copy': hterm.PreferenceManager.definePref_(
'Let the browser handle text copying',
hterm.PreferenceManager.Categories.CopyPaste,
false, 'bool',
`Whether to use the default browser/OS's copy behavior.\n` +
`\n` +
`Allow the browser/OS to handle the copy event directly which might ` +
`improve compatibility with some systems (where copying doesn't work ` +
`at all), but makes the text selection less robust.\n` +
`\n` +
`For example, long lines that were automatically line wrapped will ` +
`be copied with the newlines still in them.`,
),
'clear-selection-after-copy': hterm.PreferenceManager.definePref_(
'Automatically clear text selection',
hterm.PreferenceManager.Categories.CopyPaste,
true, 'bool',
`Whether to clear the selection after copying.`,
),
'ctrl-plus-minus-zero-zoom': hterm.PreferenceManager.definePref_(
'Ctrl++/-/0 zoom behavior',
hterm.PreferenceManager.Categories.Keyboard,
true, 'bool',
`If true, Ctrl+Plus/Minus/Zero controls zoom.\n` +
`If false, Ctrl+Shift+Plus/Minus/Zero controls zoom, Ctrl+Minus sends ` +
`^_, Ctrl+Plus/Zero do nothing.`,
),
'ctrl-c-copy': hterm.PreferenceManager.definePref_(
'Ctrl+C copy behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Ctrl+C copies if true, send ^C to host if false.\n` +
`Ctrl+Shift+C sends ^C to host if true, copies if false.`,
),
'ctrl-v-paste': hterm.PreferenceManager.definePref_(
'Ctrl+V paste behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Ctrl+V pastes if true, send ^V to host if false.\n` +
`Ctrl+Shift+V sends ^V to host if true, pastes if false.`,
),
'east-asian-ambiguous-as-two-column': hterm.PreferenceManager.definePref_(
'East Asian Ambiguous use two columns',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether East Asian Ambiguous characters have two column width.`,
),
'enable-8-bit-control': hterm.PreferenceManager.definePref_(
'Support non-UTF-8 C1 control characters',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`True to enable 8-bit control characters, false to ignore them.\n` +
`\n` +
`We'll respect the two-byte versions of these control characters ` +
`regardless of this setting.`,
),
'enable-bold': hterm.PreferenceManager.definePref_(
'Bold text behavior',
hterm.PreferenceManager.Categories.Appearance,
null, 'tristate',
`If true, use bold weight font for text with the bold/bright ` +
`attribute. False to use the normal weight font. Null to autodetect.`,
),
'enable-bold-as-bright': hterm.PreferenceManager.definePref_(
'Use bright colors with bold text',
hterm.PreferenceManager.Categories.Appearance,
true, 'bool',
`If true, use bright colors (8-15 on a 16 color palette) for any text ` +
`with the bold attribute. False otherwise.`,
),
'enable-blink': hterm.PreferenceManager.definePref_(
'Enable blinking text',
hterm.PreferenceManager.Categories.Appearance,
true, 'bool',
`If true, respect the blink attribute. False to ignore it.`,
),
'enable-clipboard-notice': hterm.PreferenceManager.definePref_(
'Show notification when copying content',
hterm.PreferenceManager.Categories.CopyPaste,
true, 'bool',
`Whether to show a message in the terminal when the host writes to the ` +
`clipboard.`,
),
'enable-clipboard-write': hterm.PreferenceManager.definePref_(
'Allow remote clipboard writes',
hterm.PreferenceManager.Categories.CopyPaste,
true, 'bool',
`Allow the remote host to write directly to the local system ` +
`clipboard.\n` +
`Read access is never granted regardless of this setting.\n` +
`\n` +
`This is used to control access to features like OSC-52.`,
),
'enable-dec12': hterm.PreferenceManager.definePref_(
'Allow changing of text cursor blinking',
hterm.PreferenceManager.Categories.Miscellaneous,
false, 'bool',
`Respect the host's attempt to change the text cursor blink status ` +
`using DEC Private Mode 12.`,
),
'enable-csi-j-3': hterm.PreferenceManager.definePref_(
'Allow clearing of scrollback buffer (CSI-J-3)',
hterm.PreferenceManager.Categories.Miscellaneous,
true, 'bool',
`Whether the Erase Saved Lines function (mode 3) of the Erase Display ` +
`command (CSI-J) may clear the terminal scrollback buffer.\n` +
`\n` +
`Enabling this by default is safe.`,
),
'environment': hterm.PreferenceManager.definePref_(
'Environment variables',
hterm.PreferenceManager.Categories.Miscellaneous,
{
// Signal ncurses based apps to use UTF-8 output instead of legacy
// drawing modes (which only work in ISO-2022 mode). Since hterm is
// always UTF-8, this shouldn't cause problems.
'NCURSES_NO_UTF8_ACS': '1',
'TERM': 'xterm-256color',
// Set this env var that a bunch of mainstream terminal emulators set
// to indicate we support true colors.
// https://gist.github.com/XVilka/8346728
'COLORTERM': 'truecolor',
},
'value',
`The initial set of environment variables, as an object.`,
),
'find-result-color': hterm.PreferenceManager.definePref_(
'Find results highlight color',
hterm.PreferenceManager.Categories.Appearance,
'rgba(102, 204, 255, 0.4)', 'color',
`The background color to highlight find results.`,
),
'find-result-selected-color': hterm.PreferenceManager.definePref_(
'Find results selected highlight color',
hterm.PreferenceManager.Categories.Appearance,
'rgba(102, 204, 255, 0.8)', 'color',
`The background color to highlight the selected find result.`,
),
'font-family': hterm.PreferenceManager.definePref_(
'Text font family',
hterm.PreferenceManager.Categories.Appearance,
'"DejaVu Sans Mono", "Noto Sans Mono", "Everson Mono", FreeMono, ' +
'Menlo, Terminal, monospace',
'string',
`Default font family for the terminal text.`,
),
'font-size': hterm.PreferenceManager.definePref_(
'Text font size',
hterm.PreferenceManager.Categories.Appearance,
15, 'int',
`The default font size in pixels.`,
),
'font-smoothing': hterm.PreferenceManager.definePref_(
'Text font smoothing',
hterm.PreferenceManager.Categories.Appearance,
'antialiased', 'string',
`CSS font-smoothing property.`,
),
'foreground-color': hterm.PreferenceManager.definePref_(
'Text color',
hterm.PreferenceManager.Categories.Appearance,
'rgb(240, 240, 240)', 'color',
`The foreground color for text with no other color attributes.`,
),
'enable-resize-status': hterm.PreferenceManager.definePref_(
'Show terminal dimensions when resized',
hterm.PreferenceManager.Categories.Appearance,
false, 'bool',
`Whether to show terminal dimensions when the terminal changes size.`,
),
'hide-mouse-while-typing': hterm.PreferenceManager.definePref_(
'Hide mouse cursor while typing',
hterm.PreferenceManager.Categories.Keyboard,
null, 'tristate',
`Whether to automatically hide the mouse cursor when typing. ` +
`By default, autodetect whether the platform/OS handles this.\n` +
`\n` +
`Note: Your operating system might override this setting and thus you ` +
`might not be able to always disable it.`,
),
'home-keys-scroll': hterm.PreferenceManager.definePref_(
'Home/End key scroll behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`If true, Home/End controls the terminal scrollbar and Shift+Home/` +
`Shift+End are sent to the remote host. If false, then Home/End are ` +
`sent to the remote host and Shift+Home/Shift+End scrolls.`,
),
'keybindings': hterm.PreferenceManager.definePref_(
'Keyboard bindings/shortcuts',
hterm.PreferenceManager.Categories.Keyboard,
null, 'value',
`A map of key sequence to key actions. Key sequences include zero or ` +
`more modifier keys followed by a key code. Key codes can be decimal ` +
`or hexadecimal numbers, or a key identifier. Key actions can be ` +
`specified as a string to send to the host, or an action identifier. ` +
`For a full explanation of the format, see https://goo.gl/LWRndr.\n` +
`\n` +
`Sample keybindings:\n` +
`{\n` +
` "Ctrl+Alt+K": "clearTerminal",\n` +
` "Ctrl+Shift+L": "PASS",\n` +
` "Ctrl+H": "'Hello World'"\n` +
`}`,
),
'keybindings-os-defaults': hterm.PreferenceManager.definePref_(
'Use default OS Keyboard bindings/shortcuts',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether common OS keyboard bindings should be respected instead of ` +
`always capturing for hterm's own use.`,
),
'media-keys-are-fkeys': hterm.PreferenceManager.definePref_(
'Media keys are Fkeys',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`If true, convert media keys to their Fkey equivalent. If false, let ` +
`the browser handle the keys.`,
),
'meta-sends-escape': hterm.PreferenceManager.definePref_(
'Meta key modifier handling',
hterm.PreferenceManager.Categories.Keyboard,
true, 'bool',
`Send an ESC prefix when pressing a key while holding the Meta key.\n` +
`\n` +
`For example, when enabled, pressing Meta+K will send ^[k as if you ` +
`typed Escape then k. When disabled, only k will be sent.`,
),
'mouse-right-click-paste': hterm.PreferenceManager.definePref_(
'Mouse right clicks paste content',
hterm.PreferenceManager.Categories.CopyPaste,
true, 'bool',
`Paste on right mouse button clicks.\n` +
`\n` +
`This option is independent of the "mouse-paste-button" setting.\n` +
`\n` +
`Note: The primary & secondary buttons are handled for you with left ` +
`& right handed mice.`,
),
'mouse-paste-button': hterm.PreferenceManager.definePref_(
'Mouse button paste',
hterm.PreferenceManager.Categories.CopyPaste,
null, [null, 0, 1, 2, 3, 4, 5, 6],
`The mouse button to use for pasting.\n` +
`\n` +
`For autodetect, we'll use the middle mouse button for non-X11 ` +
`platforms (including Chrome OS). On X11, we'll use the right mouse ` +
`button (since the window manager should handle pasting via the middle ` +
`mouse button).\n` +
`\n` +
`0 == left (primary) button.\n` +
`1 == middle (auxiliary) button.\n` +
`2 == right (secondary) button.\n` +
`\n` +
`This option is independent of the setting for right-click paste.\n` +
`\n` +
`Note: The primary & secondary buttons are handled for you with left ` +
`& right handed mice.`,
),
'screen-padding-size': hterm.PreferenceManager.definePref_(
'Screen padding size',
hterm.PreferenceManager.Categories.Appearance,
8, 'int',
`The padding size in pixels around the border of the terminal screen.\n` +
`\n` +
`This controls the size of the border around the terminal screen so ` +
`the user can add some visible padding to the edges of the screen.`,
),
'screen-border-size': hterm.PreferenceManager.definePref_(
'Screen border size',
hterm.PreferenceManager.Categories.Appearance,
0, 'int',
`The border size in pixels around the terminal screen.\n` +
`\n` +
`This controls the size of the border around the terminal screen to ` +
`create a visible line at the edges of the screen.`,
),
'screen-border-color': hterm.PreferenceManager.definePref_(
'Screen border color',
hterm.PreferenceManager.Categories.Appearance,
'rgb(128, 128, 128)', 'color',
`The color for the border around the terminal screen.\n` +
`\n` +
`This controls the color of the border around the terminal screen to ` +
`create a visible line at the edges of the screen.`,
),
'word-break-match-left': hterm.PreferenceManager.definePref_(
'Automatic selection halting (to the left)',
hterm.PreferenceManager.Categories.CopyPaste,
// TODO(vapier): Switch \u back to ‘“‹« once builders are fixed.
'[^\\s[\\](){}<>"\'^!@#$%&*,;:`\u{2018}\u{201c}\u{2039}\u{ab}]', 'string',
`Regular expression to halt matching to the left (start) of a ` +
`selection.\n` +
`\n` +
`Normally this is a character class to reject specific characters.\n` +
`We allow "~" and "." by default as paths frequently start with those.`,
),
'word-break-match-right': hterm.PreferenceManager.definePref_(
'Automatic selection halting (to the right)',
hterm.PreferenceManager.Categories.CopyPaste,
// TODO(vapier): Switch \u back to ’”›» once builders are fixed.
'[^\\s[\\](){}<>"\'^!@#$%&*,;:~.`\u{2019}\u{201d}\u{203a}\u{bb}]',
'string',
`Regular expression to halt matching to the right (end) of a ` +
`selection.\n` +
`\n` +
`Normally this is a character class to reject specific characters.`,
),
'word-break-match-middle': hterm.PreferenceManager.definePref_(
'Word break characters',
hterm.PreferenceManager.Categories.CopyPaste,
'[^\\s[\\](){}<>"\'^]*', 'string',
`Regular expression to match all the characters in the middle.\n` +
`\n` +
`Normally this is a character class to reject specific characters.\n` +
`\n` +
`Used to expand the selection surrounding the starting point.`,
),
'page-keys-scroll': hterm.PreferenceManager.definePref_(
'Page Up/Down key scroll behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`If true, Page Up/Page Down controls the terminal scrollbar and ` +
`Shift+Page Up/Shift+Page Down are sent to the remote host. If false, ` +
`then Page Up/Page Down are sent to the remote host and Shift+Page Up/` +
`Shift+Page Down scrolls.`,
),
'pass-alt-number': hterm.PreferenceManager.definePref_(
'Alt+1..9 switch tab/app behavior',
hterm.PreferenceManager.Categories.Keyboard,
null, 'tristate',
`Whether Alt+1..9 is passed to the browser.\n` +
`\n` +
`This is handy when running hterm in a browser tab, so that you don't ` +
`lose Chrome's "switch to tab/app" keyboard shortcuts. When not ` +
`running in a tab it's better to send these keys to the host so they ` +
`can be used in vim or emacs.\n` +
`\n` +
`If true, Alt+1..9 will be handled by the browser. If false, Alt+1..9 ` +
`will be sent to the host. If null, autodetect based on browser ` +
`platform and window type.`,
),
'pass-ctrl-number': hterm.PreferenceManager.definePref_(
'Ctrl+1..9 switch tab behavior',
hterm.PreferenceManager.Categories.Keyboard,
null, 'tristate',
`Whether Ctrl+1..9 is passed to the browser.\n` +
`\n` +
`This is handy when running hterm in a browser tab, so that you don't ` +
`lose Chrome's "switch to tab" keyboard shortcuts. When not running ` +
`in a tab it's better to send these keys to the host so they can be ` +
`used in vim or emacs.\n` +
`\n` +
`If true, Ctrl+1..9 will be handled by the browser. If false, ` +
`Ctrl+1..9 will be sent to the host. If null, autodetect based on ` +
`browser platform and window type.`,
),
'pass-ctrl-n': hterm.PreferenceManager.definePref_(
'Ctrl+N new window behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether Ctrl+N is passed to the browser.\n` +
`\n` +
`If true, Ctrl+N will be handled by the browser as the "new window" ` +
`keyboard shortcut. If false, Ctrl+N will be sent to the host.`,
),
'pass-ctrl-t': hterm.PreferenceManager.definePref_(
'Ctrl+T new tab behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether Ctrl+T is passed to the browser.\n` +
`\n` +
`If true, Ctrl+T will be handled by the browser as the "new tab" ` +
`keyboard shortcut. If false, Ctrl+T will be sent to the host.`,
),
'pass-ctrl-tab': hterm.PreferenceManager.definePref_(
'Ctrl+Tab switch tab behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether Ctrl+Tab and Ctrl+Shift+Tab are passed to the browser.\n` +
`\n` +
`If true, Ctrl+Tab and Ctrl+Shift+Tab will be handled by the browser ` +
`as the "next/previous tab" keyboard shortcut. If false, the Tab ` +
`key is sent to the host without Ctrl or Shift.`,
),
'pass-ctrl-w': hterm.PreferenceManager.definePref_(
'Ctrl+W close tab behavior',
hterm.PreferenceManager.Categories.Keyboard,
false, 'bool',
`Whether Ctrl+W is passed to the browser.\n` +
`\n` +
`If true, Ctrl+W will be handled by the browser as the "close tab" ` +
`keyboard shortcut. If false, Ctrl+W will be sent to the host.`,
),
'pass-meta-number': hterm.PreferenceManager.definePref_(
'Meta+1..9 switch tab behavior',
hterm.PreferenceManager.Categories.Keyboard,
null, 'tristate',
`Whether Meta+1..9 is passed to the browser.\n` +
`\n` +
`This is handy when running hterm in a browser tab, so that you don't ` +
`lose Chrome's "switch to tab" keyboard shortcuts. When not running ` +
`in a tab it's better to send these keys to the host so they can be ` +
`used in vim or emacs.\n` +
`\n` +
`If true, Meta+1..9 will be handled by the browser. If false, ` +
`Meta+1..9 will be sent to the host. If null, autodetect based on ` +
`browser platform and window type.`,
),
'pass-meta-v': hterm.PreferenceManager.definePref_(
'Meta+V paste behavior',
hterm.PreferenceManager.Categories.Keyboard,
true, 'bool',
`Whether Meta+V gets passed to the browser.\n` +
`\n` +
`On some systems, this is used to paste content.`,
),
'paste-on-drop': hterm.PreferenceManager.definePref_(
'Allow drag & drop to paste',
hterm.PreferenceManager.Categories.CopyPaste,
true, 'bool',
`If true, Drag and dropped text will paste into terminal.\n` +
`If false, dropped text will be ignored.`,
),
'scroll-on-keystroke': hterm.PreferenceManager.definePref_(
'Scroll to bottom after keystroke',
hterm.PreferenceManager.Categories.Scrolling,
true, 'bool',
`Whether to scroll to the bottom on any keystroke.`,
),
'scroll-on-output': hterm.PreferenceManager.definePref_(
'Scroll to bottom after new output',
hterm.PreferenceManager.Categories.Scrolling,
false, 'bool',
`Whether to scroll to the bottom on terminal output.`,
),
'scrollbar-visible': hterm.PreferenceManager.definePref_(
'Scrollbar visibility',
hterm.PreferenceManager.Categories.Scrolling,
true, 'bool',
`The vertical scrollbar mode.`,
),
'scroll-wheel-may-send-arrow-keys': hterm.PreferenceManager.definePref_(
'Emulate arrow keys with scroll wheel',
hterm.PreferenceManager.Categories.Scrolling,
false, 'bool',
`When using the alternative screen buffer, and DECCKM (Application ` +
`Cursor Keys) is active, mouse scroll wheel events will emulate arrow ` +
`keys.\n` +
`\n` +
`It can be temporarily disabled by holding the Shift key.\n` +
`\n` +
`This frequently comes up when using pagers (less) or reading man ` +
`pages or text editors (vi/nano) or using screen/tmux.`,
),
'scroll-wheel-move-multiplier': hterm.PreferenceManager.definePref_(
'Mouse scroll wheel multiplier',
hterm.PreferenceManager.Categories.Scrolling,
1, 'int',
`The multiplier for mouse scroll wheel events when measured in ` +
`pixels.\n` +
`\n` +
`Alters how fast the page scrolls.`,
),
'terminal-encoding': hterm.PreferenceManager.definePref_(
'Terminal encoding',
hterm.PreferenceManager.Categories.Encoding,
'utf-8', ['iso-2022', 'utf-8', 'utf-8-locked'],
`The default terminal encoding (DOCS).\n` +
`\n` +
`ISO-2022 enables character map translations (like graphics maps).\n` +
`UTF-8 disables support for those.\n` +
`\n` +
`The locked variant means the encoding cannot be changed at runtime ` +
`via terminal escape sequences.\n` +
`\n` +
`You should stick with UTF-8 unless you notice broken rendering with ` +
`legacy applications.`,
),
'shift-insert-paste': hterm.PreferenceManager.definePref_(
'Shift+Insert paste',
hterm.PreferenceManager.Categories.Keyboard,
true, 'bool',
`Whether Shift+Insert is used for pasting or is sent to the remote host.`,
),
'user-css': hterm.PreferenceManager.definePref_(
'Custom CSS (URI)',
hterm.PreferenceManager.Categories.Appearance,
'', 'url',
`URL of user stylesheet to include in the terminal document.`,
),
'user-css-text': hterm.PreferenceManager.definePref_(
'Custom CSS (inline text)',
hterm.PreferenceManager.Categories.Appearance,
'', 'multiline-string',
`Custom CSS text for styling the terminal.`,
),
'allow-images-inline': hterm.PreferenceManager.definePref_(
'Allow inline image display',
hterm.PreferenceManager.Categories.Extensions,
null, 'tristate',
`Whether to allow the remote host to display images in the terminal.\n` +
`\n` +
`By default, we prompt until a choice is made.`,
),
};
hterm.PreferenceManager.prototype =
Object.create(lib.PreferenceManager.prototype);
/** @override */
hterm.PreferenceManager.constructor = hterm.PreferenceManager;