[pve-devel] [PATCH xtermjs 3/4] implement terminal settings for 3.x
Dominik Csapak
d.csapak at proxmox.com
Tue Apr 10 14:16:59 CEST 2018
since xtermjs 3.0, the display is not via html anymore, but a canvas
so we cannot use css overrides anymore
this enables us to let the user set a fontsize/family/etc.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/www/main.js | 2 +-
src/www/util.js | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/www/main.js b/src/www/main.js
index 4aa856c..461b6e6 100644
--- a/src/www/main.js
+++ b/src/www/main.js
@@ -70,7 +70,7 @@ Terminal.applyAddon(fit);
createTerminal();
function createTerminal() {
- term = new Terminal();
+ term = new Terminal(getTerminalSettings());
term.on('resize', function (size) {
if (state === states.connected) {
diff --git a/src/www/util.js b/src/www/util.js
index b2c40e3..fc6ef07 100644
--- a/src/www/util.js
+++ b/src/www/util.js
@@ -179,3 +179,17 @@ function API2Request(reqOpts) {
throw "unknown method";
}
}
+
+function getTerminalSettings() {
+ var res = {};
+ var settings = ['fontSize', 'fontFamily', 'letterSpacing', 'lineHeight'];
+ if(localStorage) {
+ settings.forEach(function(setting) {
+ var val = localStorage.getItem('pve-xterm-' + setting);
+ if (val !== undefined && val !== null) {
+ res[setting] = val;
+ }
+ });
+ }
+ return res;
+}
--
2.11.0
More information about the pve-devel
mailing list