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.csa...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to