From 37445374a339e0d6a0bf2e73d7fe516f9c3bf2af Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 10 Apr 2018 14:01:56 +0200 Subject: [PATCH] implement terminal settings for 3.x 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 --- 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.39.2