mirror of
https://github.com/yudai/gotty.git
synced 2025-12-24 11:20:13 +01:00
Add WebGL support
This commit is contained in:
parent
d8c1de5116
commit
84235c20fa
7 changed files with 47 additions and 5 deletions
3
.gotty
3
.gotty
|
|
@ -201,6 +201,9 @@
|
|||
// [bool] Respect the host's attempt to change the cursor blink status using DEC Private Mode 12.
|
||||
// enable_dec12 = false
|
||||
|
||||
// [bool] Enable webgl rendering in the browser client terminal(hterm)
|
||||
// enable_webgl = false
|
||||
|
||||
// [map[string]string] The default environment variables, as an object.
|
||||
// environment = {"TERM" = "xterm-256color"}
|
||||
|
||||
|
|
|
|||
13
README.md
13
README.md
|
|
@ -103,6 +103,19 @@ preferences {
|
|||
|
||||
See the [`.gotty`](https://github.com/ghthor/gotty/blob/master/.gotty) file in this repository for the list of configuration options.
|
||||
|
||||
#### Enable WebGL
|
||||
|
||||
The WebGL renderer is much better than the default canvas renderer for text; it
|
||||
can handle italics without clipping the letters. I think this is because
|
||||
upstream xtermjs is focusing on the WebGL renderer. To enable WebGL you need to
|
||||
add the following to your `~/.gotty` config file.
|
||||
|
||||
```hcl
|
||||
preferences {
|
||||
enable_webgl = true
|
||||
}
|
||||
```
|
||||
|
||||
### Security Options
|
||||
|
||||
By default, GoTTY doesn't allow clients to send any keystrokes or commands except terminal window resizing. When you want to permit clients to write input to the TTY, add the `-w` option. However, accepting input from remote clients is dangerous for most commands. When you need interaction with the TTY for some reasons, consider starting GoTTY with tmux or GNU Screen and run your command on it (see "Sharing with Multiple Clients" section for detail).
|
||||
|
|
|
|||
17
js/package-lock.json
generated
17
js/package-lock.json
generated
|
|
@ -7,7 +7,8 @@
|
|||
"dependencies": {
|
||||
"libapps": "github:yudai/libapps#release-hterm-1.70",
|
||||
"xterm": "^4.17",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"xterm-addon-webgl": "^0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"license-loader": "^0.5.0",
|
||||
|
|
@ -1568,6 +1569,14 @@
|
|||
"peerDependencies": {
|
||||
"xterm": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xterm-addon-webgl": {
|
||||
"version": "0.11.4",
|
||||
"resolved": "https://registry.npmjs.org/xterm-addon-webgl/-/xterm-addon-webgl-0.11.4.tgz",
|
||||
"integrity": "sha512-/a/VFeftc+etGXQYWaaks977j1P7/wickBXn15zDxZzXYYMT9RN17ztqyIDVLXg9krtg28+icKK6lvgIYghJ0w==",
|
||||
"peerDependencies": {
|
||||
"xterm": "^4.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
@ -2740,6 +2749,12 @@
|
|||
"resolved": "https://registry.npmjs.org/xterm-addon-fit/-/xterm-addon-fit-0.5.0.tgz",
|
||||
"integrity": "sha512-DsS9fqhXHacEmsPxBJZvfj2la30Iz9xk+UKjhQgnYNkrUIN5CYLbw7WEfz117c7+S86S/tpHPfvNxJsF5/G8wQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"xterm-addon-webgl": {
|
||||
"version": "0.11.4",
|
||||
"resolved": "https://registry.npmjs.org/xterm-addon-webgl/-/xterm-addon-webgl-0.11.4.tgz",
|
||||
"integrity": "sha512-/a/VFeftc+etGXQYWaaks977j1P7/wickBXn15zDxZzXYYMT9RN17ztqyIDVLXg9krtg28+icKK6lvgIYghJ0w==",
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
"dependencies": {
|
||||
"libapps": "github:yudai/libapps#release-hterm-1.70",
|
||||
"xterm": "^4.17",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"xterm-addon-webgl": "^0.11.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,11 @@ export class Hterm {
|
|||
};
|
||||
|
||||
setPreferences(value: object) {
|
||||
Object.keys(value).forEach((key) => {
|
||||
this.term.getPrefs().set(key, value[key]);
|
||||
});
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key != "enable-webgl") {
|
||||
this.term.getPrefs().set(key, value[key]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onInput(callback: (input: string) => void) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {lib} from "libapps";
|
|||
|
||||
import {IDisposable, Terminal} from 'xterm';
|
||||
import {FitAddon} from "xterm-addon-fit";
|
||||
import {WebglAddon} from "xterm-addon-webgl";
|
||||
|
||||
|
||||
export class Xterm {
|
||||
|
|
@ -84,6 +85,11 @@ export class Xterm {
|
|||
};
|
||||
|
||||
setPreferences(value: object) {
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key && key == "enable-webgl") {
|
||||
this.term.loadAddon(new WebglAddon());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onInput(callback: (input: string) => void) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ func (options *Options) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// TODO(ghthor): add defaults to all these options that match the example .gotty file
|
||||
type HtermPrefernces struct {
|
||||
AltGrMode *string `hcl:"alt_gr_mode" json:"alt-gr-mode,omitempty"`
|
||||
AltBackspaceIsMetaBackspace bool `hcl:"alt_backspace_is_meta_backspace" json:"alt-backspace-is-meta-backspace,omitempty"`
|
||||
|
|
@ -72,6 +73,7 @@ type HtermPrefernces struct {
|
|||
EnableClipboardNotice bool `hcl:"enable_clipboard_notice" json:"enable-clipboard-notice,omitempty"`
|
||||
EnableClipboardWrite bool `hcl:"enable_clipboard_write" json:"enable-clipboard-write,omitempty"`
|
||||
EnableDec12 bool `hcl:"enable_dec12" json:"enable-dec12,omitempty"`
|
||||
EnableWebGL bool `hcl:"enable_webgl" json:"enable-webgl,omitempty"`
|
||||
Environment map[string]string `hcl:"environment" json:"environment,omitempty"`
|
||||
FontFamily string `hcl:"font_family" json:"font-family,omitempty"`
|
||||
FontSize int `hcl:"font_size" json:"font-size,omitempty"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue