From 57816f731f5a1b35b9689f6eedfc913da27fd2b7 Mon Sep 17 00:00:00 2001 From: Ni Rui Date: Sun, 18 Sep 2022 20:20:33 +0800 Subject: [PATCH] Swap Hack font with @azurity/pure-nerd-font which provides more icons than Hack --- DEPENDENCIES.md | 14 ++++++- package-lock.json | 26 ++++++------ package.json | 2 +- ui/widgets/screen_console.css | 7 ++-- ui/widgets/screen_console.vue | 76 ++++++++++++++++++----------------- 5 files changed, 70 insertions(+), 55 deletions(-) diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 3e7b7e6..633c123 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -17,8 +17,20 @@ Major dependencies includes: Packaged by [Christian Hoffmeister](https://github.com/choffmeister/roboto-fontface-bower), Licensed under Apache 2.0 - [iconv-lite](https://github.com/ashtuchkin/iconv-lite), Licensed under MIT license - [buffer](https://github.com/feross/buffer), Licensed under MIT license -- [Hack font](https://github.com/source-foundry/Hack), [View license](https://github.com/source-foundry/Hack/blob/master/LICENSE.md) - [fontfaceobserver](https://github.com/bramstein/fontfaceobserver), [View license](https://github.com/bramstein/fontfaceobserver/blob/master/LICENSE) +- [Nerd Font](https://www.nerdfonts.com/), packaged by [@azurity/pure-nerd-font](http://github.com/azurity/pure-nerd-font) + includes icons from following fonts: + - [Powerline Extra Symbols](https://github.com/ryanoasis/powerline-extra-symbols), Licensed under MIT license + - [Font Awesome](https://github.com/FortAwesome/Font-Awesome), [View license](https://github.com/FortAwesome/Font-Awesome/blob/6.x/LICENSE.txt) + - [Font Awesome Extension](https://github.com/AndreLZGava/font-awesome-extension), Licensed under MIT license + - [Material Design Icons](https://github.com/Templarian/MaterialDesign), [View license](https://github.com/Templarian/MaterialDesign/blob/master/LICENSE) + - [Weather Icons](https://github.com/erikflowers/weather-icons), Licensed under SIL OFL 1.1 + - [Devicons](https://github.com/vorillaz/devicons), Licensed under MIT license + - [Octicons](https://github.com/primer/octicons), Licensed under MIT license + - [Codicons](https://github.com/microsoft/vscode-codicons), Licensed under MIT License + - [Font Logos (Formerly Font Linux)](https://github.com/Lukas-W/font-logos), Licensed under Unlicense license + - [Pomicons](https://github.com/gabrielelana/pomicons), Licensed under OFL-1.1 license + - ... and more, see [full list](https://github.com/ryanoasis/nerd-fonts/tree/master/src/glyphs) ## For back-end application diff --git a/package-lock.json b/package-lock.json index 9c13c73..a53efa1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "license": "AGPL-3.0", "devDependencies": { + "@azurity/pure-nerd-font": "^1.0.0", "@babel/core": "^7.19.0", "@babel/eslint-parser": "^7.18.9", "@babel/plugin-transform-runtime": "^7.18.10", @@ -29,7 +30,6 @@ "eslint-webpack-plugin": "^3.2.0", "favicons": "^7.0.0", "fontfaceobserver": "^2.3.0", - "hack-font": "^3.3.0", "html-loader": "^4.1.0", "html-webpack-plugin": "^5.5.0", "iconv-lite": "^0.6.3", @@ -71,6 +71,12 @@ "node": ">=6.0.0" } }, + "node_modules/@azurity/pure-nerd-font": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@azurity/pure-nerd-font/-/pure-nerd-font-1.0.0.tgz", + "integrity": "sha512-cwgO277jMoNa5Xjn6mozYFZiOS7T9VSCZp5YmvHRnnpfn625sLJYWwtRN4HZlXQCd/qBWfNtf7xwtxa9JHUYLQ==", + "dev": true + }, "node_modules/@babel/code-frame": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", @@ -5904,12 +5910,6 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, - "node_modules/hack-font": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/hack-font/-/hack-font-3.3.0.tgz", - "integrity": "sha512-RohrcAr3UaKiIoxDlOytCjObcUAucfFc6V5fKu6gBrvmvTfIXeBqZwR0Q5kb9qpbluThJWt326LClLKIGiFyug==", - "dev": true - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -11437,6 +11437,12 @@ "@jridgewell/trace-mapping": "^0.3.9" } }, + "@azurity/pure-nerd-font": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@azurity/pure-nerd-font/-/pure-nerd-font-1.0.0.tgz", + "integrity": "sha512-cwgO277jMoNa5Xjn6mozYFZiOS7T9VSCZp5YmvHRnnpfn625sLJYWwtRN4HZlXQCd/qBWfNtf7xwtxa9JHUYLQ==", + "dev": true + }, "@babel/code-frame": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", @@ -15761,12 +15767,6 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, - "hack-font": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/hack-font/-/hack-font-3.3.0.tgz", - "integrity": "sha512-RohrcAr3UaKiIoxDlOytCjObcUAucfFc6V5fKu6gBrvmvTfIXeBqZwR0Q5kb9qpbluThJWt326LClLKIGiFyug==", - "dev": true - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", diff --git a/package.json b/package.json index 0185347..4eb1ac6 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Sshwifty Web Front-end Project", "main": "", "devDependencies": { + "@azurity/pure-nerd-font": "1.0.0", "@babel/core": "^7.19.0", "@babel/eslint-parser": "^7.18.9", "@babel/plugin-transform-runtime": "^7.18.10", @@ -24,7 +25,6 @@ "eslint-webpack-plugin": "^3.2.0", "favicons": "^7.0.0", "fontfaceobserver": "^2.3.0", - "hack-font": "^3.3.0", "html-loader": "^4.1.0", "html-webpack-plugin": "^5.5.0", "iconv-lite": "^0.6.3", diff --git a/ui/widgets/screen_console.css b/ui/widgets/screen_console.css index bb30467..11c261e 100644 --- a/ui/widgets/screen_console.css +++ b/ui/widgets/screen_console.css @@ -20,18 +20,19 @@ @charset "utf-8"; @import "~hack-font/build/web/hack.css"; +@import "~@azurity/pure-nerd-font/pure-nerd-font.css"; #connector-resource-preload-control-console { - font-family: Hack; + font-family: PureNerdFont; } #connector-resource-preload-control-console::after { content: " "; - font-family: Hack; + font-family: PureNerdFont; font-weight: bold; } #connector-resource-preload-control-console::before { content: " "; - font-family: Hack; + font-family: PureNerdFont; font-style: italic; } diff --git a/ui/widgets/screen_console.vue b/ui/widgets/screen_console.vue index 5f9892b..acd1533 100644 --- a/ui/widgets/screen_console.vue +++ b/ui/widgets/screen_console.vue @@ -117,7 +117,7 @@ import { consoleScreenKeys } from "./screen_console_keys.js"; import "./screen_console.css"; import "xterm/css/xterm.css"; -const termTypeFace = "Hack"; +const termTypeFace = "PureNerdFont"; const termFallbackTypeFace = "monospace"; const termTypeFaceLoadTimeout = 3000; const termTypeFaceLoadError = @@ -200,46 +200,48 @@ class Term { } }); - this.term.attachCustomKeyEventHandler(async (ev) => { - if (this.closed) { - return true; - } + // It seems Xtermjs now handles copy paste by itself, following code is no + // longer useful + // this.term.attachCustomKeyEventHandler(async (ev) => { + // if (this.closed) { + // return true; + // } - if ( - ev.type == "keyup" && - ((ev.key.toLowerCase() === "v" && ev.shiftKey && ev.ctrlKey) || - (ev.key === "Insert" && ev.shiftKey)) - ) { - try { - let text = await window.navigator.clipboard.readText(); + // if ( + // ev.type == "keyup" && + // ((ev.key.toLowerCase() === "v" && ev.shiftKey && ev.ctrlKey) || + // (ev.key === "Insert" && ev.shiftKey)) + // ) { + // try { + // let text = await window.navigator.clipboard.readText(); - this.writeEchoStr(text); - } catch (e) { - alert( - "Unable to paste: " + - e + - ". Please try again without using the Control+Shift+V / " + - "Shift+Insert hot key" - ); - } - return false; - } + // this.writeEchoStr(text); + // } catch (e) { + // alert( + // "Unable to paste: " + + // e + + // ". Please try again without using the Control+Shift+V / " + + // "Shift+Insert hot key" + // ); + // } + // return false; + // } - if ( - ev.type == "keyup" && - ((ev.key.toLowerCase() === "c" && ev.shiftKey && ev.ctrlKey) || - (ev.key === "Insert" && ev.ctrlKey)) - ) { - try { - window.navigator.clipboard.writeText(this.term.getSelection()); - } catch (e) { - alert("Unable to copy: " + e); - } - return false; - } + // if ( + // ev.type == "keyup" && + // ((ev.key.toLowerCase() === "c" && ev.shiftKey && ev.ctrlKey) || + // (ev.key === "Insert" && ev.ctrlKey)) + // ) { + // try { + // window.navigator.clipboard.writeText(this.term.getSelection()); + // } catch (e) { + // alert("Unable to copy: " + e); + // } + // return false; + // } - return true; - }); + // return true; + // }); let resizeDelay = null, oldRows = 0,