From 1776fe871807904d8ee154f3d19f44a0caf7aa71 Mon Sep 17 00:00:00 2001 From: Tom LIENARD Date: Mon, 25 May 2020 15:50:39 +0200 Subject: [PATCH] More improvments --- package.json | 1 + src/app/appTerminal.ts | 3 +- src/ui/App.vue | 13 ++- src/ui/components/BottomNav.vue | 144 ++++++++++++++++++++++++++++++++ src/ui/components/Terminal.vue | 2 +- src/utils/utils.ts | 11 +++ yarn.lock | 5 ++ 7 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 src/ui/components/BottomNav.vue diff --git a/package.json b/package.json index 6d7a116..d130542 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "node-pty": "0.9.0", "sass": "^1.26.5", "sass-loader": "^8.0.2", + "systeminformation": "^4.26.4", "v8-compile-cache": "^2.1.0", "vue": "^2.6.11", "vue-class-component": "^7.2.3", diff --git a/src/app/appTerminal.ts b/src/app/appTerminal.ts index d6a9961..b453193 100644 --- a/src/app/appTerminal.ts +++ b/src/app/appTerminal.ts @@ -7,7 +7,7 @@ import { LigaturesAddon } from 'xterm-addon-ligatures'; import { Unicode11Addon } from 'xterm-addon-unicode11'; import Options, { IOptions, ITheme } from '@/options/options'; import AppWatcher from '@/app/appWatcher'; -import { remote } from 'electron'; +import { remote, clipboard } from 'electron'; export default class AppTerminal { @@ -36,6 +36,7 @@ export default class AppTerminal { // Listeners this.xterm.onResize((data: {cols: number, rows: number}) => this.onResize(data)); this.xterm.onData((data: string) => this.onData(data)); + this.xterm.onSelectionChange(() => clipboard.writeText(this.xterm.getSelection(), 'selection')); this.ptyProcess.onData((data: string) => this.onPtyData(data)); this.ptyProcess.onExit(() => this.exit()); diff --git a/src/ui/App.vue b/src/ui/App.vue index 163fdde..be109e4 100644 --- a/src/ui/App.vue +++ b/src/ui/App.vue @@ -7,13 +7,15 @@ +
+ + diff --git a/src/ui/components/Terminal.vue b/src/ui/components/Terminal.vue index ad7fd2b..55eb0d0 100644 --- a/src/ui/components/Terminal.vue +++ b/src/ui/components/Terminal.vue @@ -134,7 +134,7 @@ position: relative; width: calc(100vw - 30px) !important; - height: calc(100vh - 30px - 30px - 30px) !important; + height: calc(100vh - 30px - 30px - 30px - 20px) !important; } .xterm .xterm-screen canvas { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 1c2fcee..fd315a4 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -2,3 +2,14 @@ const electron = require('electron'); // The user data path export const userDataPath = (electron.app || electron.remote.app).getPath('userData'); + +export const formatUptime = (sec: number) => { + + const pad = (sec: number) => (sec < 10 ? '0' : '') + sec; + + const hours = Math.floor(sec / (60*60)); + const minutes = Math.floor(sec % (60*60) / 60); + const seconds = Math.floor(sec % 60); + + return pad(hours) + ':' + pad(minutes) + ':' + pad(seconds); +}; diff --git a/yarn.lock b/yarn.lock index 44ae8b9..aae61c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8980,6 +8980,11 @@ svgo@^1.0.0: unquote "~1.1.1" util.promisify "~1.0.0" +systeminformation@^4.26.4: + version "4.26.4" + resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-4.26.4.tgz#ec855d64f3e28622788a96c7dcabb6b051def50a" + integrity sha512-4+AYe0SfjdQPHEFL0nAyFMWyBUe8c5DZdSHApeJrdAvem5yoE/eS7/dGChnKLAkr+AKAoKcnqucPv302jy2+aA== + table@^5.2.3: version "5.4.6" resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"