From 676bbba7a4f785c555557fc02e9fd1846635b1f2 Mon Sep 17 00:00:00 2001 From: Gobius Dolhain Date: Mon, 20 Apr 2020 18:38:02 +0200 Subject: [PATCH 1/5] Add dock always on top setting --- app/lib/window.ts | 9 +++++++-- terminus-core/src/configDefaults.yaml | 1 + terminus-core/src/services/docking.service.ts | 4 +++- .../src/components/settingsTab.component.pug | 9 +++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/lib/window.ts b/app/lib/window.ts index 46234440..c90baaca 100644 --- a/app/lib/window.ts +++ b/app/lib/window.ts @@ -193,8 +193,13 @@ export class Window { this.window.focus() }) } else { - // docked, visible - this.window.hide() + if (this.configStore.appearance?.dockAlwaysOnTop) { + // docked, visible, on top + this.window.hide() + } else { + // docked, visible, not on top + this.window.focus() + } } } } diff --git a/terminus-core/src/configDefaults.yaml b/terminus-core/src/configDefaults.yaml index 3cba8f8a..57ab6d01 100644 --- a/terminus-core/src/configDefaults.yaml +++ b/terminus-core/src/configDefaults.yaml @@ -2,6 +2,7 @@ appearance: dock: off dockScreen: current dockFill: 0.5 + dockAlwaysOnTop: true tabsLocation: top cycleTabs: true theme: Standard diff --git a/terminus-core/src/services/docking.service.ts b/terminus-core/src/services/docking.service.ts index a015ebfc..85131ed1 100644 --- a/terminus-core/src/services/docking.service.ts +++ b/terminus-core/src/services/docking.service.ts @@ -53,7 +53,9 @@ export class DockingService { newBounds.y = display.bounds.y } - this.hostApp.setAlwaysOnTop(true) + const alwaysOnTop = this.config.store.appearance.dockAlwaysOnTop + + this.hostApp.setAlwaysOnTop(alwaysOnTop) setImmediate(() => { this.hostApp.setBounds(newBounds) }) diff --git a/terminus-settings/src/components/settingsTab.component.pug b/terminus-settings/src/components/settingsTab.component.pug index ad0e6f60..edf49caf 100644 --- a/terminus-settings/src/components/settingsTab.component.pug +++ b/terminus-settings/src/components/settingsTab.component.pug @@ -207,6 +207,15 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab') ) | {{screen.name}} + .form-line(*ngIf='config.store.appearance.dock != "off"') + .header + .title Dock always on top + .description Keep docked terminal always on top + toggle( + [(ngModel)]='config.store.appearance.dockAlwaysOnTop', + (ngModelChange)='config.save(); docking.dock()', + ) + .form-line(*ngIf='config.store.appearance.dock != "off"') .header .title Docked terminal size From 7b9ff043ad6471de27aacaa8cd16283be0233551 Mon Sep 17 00:00:00 2001 From: Gobius Dolhain Date: Mon, 20 Apr 2020 19:19:41 +0200 Subject: [PATCH 2/5] eslint: fix whitespace --- app/lib/window.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/window.ts b/app/lib/window.ts index c90baaca..ba648116 100644 --- a/app/lib/window.ts +++ b/app/lib/window.ts @@ -193,7 +193,7 @@ export class Window { this.window.focus() }) } else { - if (this.configStore.appearance?.dockAlwaysOnTop) { + if (this.configStore.appearance?.dockAlwaysOnTop) { // docked, visible, on top this.window.hide() } else { From 6f8ba6b44b8261c8ae43b55c09a696aa95e11992 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 21 Apr 2020 04:22:41 +0000 Subject: [PATCH 3/5] Bump @typescript-eslint/parser from 2.27.0 to 2.29.0 Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.27.0 to 2.29.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.29.0/packages/parser) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 8f26f54b..0c90a5d8 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@types/node": "12.7.12", "@types/webpack-env": "1.15.0", "@typescript-eslint/eslint-plugin": "^2.26.0", - "@typescript-eslint/parser": "^2.27.0", + "@typescript-eslint/parser": "^2.29.0", "apply-loader": "2.0.0", "awesome-typescript-loader": "^5.0.0", "core-js": "^3.6.5", diff --git a/yarn.lock b/yarn.lock index 1bc6c7b9..4b3e4f81 100644 --- a/yarn.lock +++ b/yarn.lock @@ -283,24 +283,24 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/experimental-utils@2.27.0": - version "2.27.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz#801a952c10b58e486c9a0b36cf21e2aab1e9e01a" - integrity sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw== +"@typescript-eslint/experimental-utils@2.29.0": + version "2.29.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.29.0.tgz#3cb8060de9265ba131625a96bbfec31ba6d4a0fe" + integrity sha512-H/6VJr6eWYstyqjWXBP2Nn1hQJyvJoFdDtsHxGiD+lEP7piGnGpb/ZQd+z1ZSB1F7dN+WsxUDh8+S4LwI+f3jw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.27.0" + "@typescript-eslint/typescript-estree" "2.29.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^2.27.0": - version "2.27.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.27.0.tgz#d91664335b2c46584294e42eb4ff35838c427287" - integrity sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg== +"@typescript-eslint/parser@^2.29.0": + version "2.29.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.29.0.tgz#6e3c4e21ed6393dc05b9d8b47f0b7e731ef21c9c" + integrity sha512-H78M+jcu5Tf6m/5N8iiFblUUv+HJDguMSdFfzwa6vSg9lKR8Mk9BsgeSjO8l2EshKnJKcbv0e8IDDOvSNjl0EA== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.27.0" - "@typescript-eslint/typescript-estree" "2.27.0" + "@typescript-eslint/experimental-utils" "2.29.0" + "@typescript-eslint/typescript-estree" "2.29.0" eslint-visitor-keys "^1.1.0" "@typescript-eslint/typescript-estree@2.26.0": @@ -316,10 +316,10 @@ semver "^6.3.0" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@2.27.0": - version "2.27.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz#a288e54605412da8b81f1660b56c8b2e42966ce8" - integrity sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg== +"@typescript-eslint/typescript-estree@2.29.0": + version "2.29.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.29.0.tgz#1be6612bb02fc37ac9f466521c1459a4744e8d3a" + integrity sha512-3YGbtnWy4az16Egy5Fj5CckkVlpIh0MADtAQza+jiMADRSKkjdpzZp/5WuvwK/Qib3Z0HtzrDFeWanS99dNhnA== dependencies: debug "^4.1.1" eslint-visitor-keys "^1.1.0" From e65d5ba93b13413151b09297ec21337441d9ce4e Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Tue, 21 Apr 2020 09:09:23 +0200 Subject: [PATCH 4/5] fixed webgl renderer (fixes #2439) --- terminus-terminal/package.json | 2 +- terminus-terminal/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/terminus-terminal/package.json b/terminus-terminal/package.json index 6129f71c..bbaae2ff 100644 --- a/terminus-terminal/package.json +++ b/terminus-terminal/package.json @@ -27,7 +27,7 @@ "runes": "^0.4.2", "slugify": "^1.4.0", "uuid": "^7.0.1", - "xterm": "^4.5.0-beta.9", + "xterm": "^4.6.0-beta.17", "xterm-addon-fit": "^0.4.0-beta.8", "xterm-addon-ligatures": "^0.2.1", "xterm-addon-search": "^0.7.0-beta.1", diff --git a/terminus-terminal/yarn.lock b/terminus-terminal/yarn.lock index 2ca08f3d..e0797ac7 100644 --- a/terminus-terminal/yarn.lock +++ b/terminus-terminal/yarn.lock @@ -257,10 +257,10 @@ xterm-addon-webgl@^0.7.0-beta.5: resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.7.0-beta.5.tgz#20fbafcf2fb2c2438977c40fd41945d297ea0c25" integrity sha512-Mf0PYiWe4GL8mcS4KnjVsosbvD2xSxUCappbTRNZ+5hQgmrayrr6UciKw7CasSLOsji8AHkoZJEl0MxMsTTEeg== -xterm@^4.5.0-beta.9: - version "4.5.0" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.5.0.tgz#c7fd145c6cf91c9f2ef07011a9b35026cf4bfecc" - integrity sha512-4t12tsvtYnv13FBJwewddxdI/j4kSonmbQQv50j34R/rPIFbUNGtptbprmuUlTDAKvHLMDZ/Np2XcpNimga/HQ== +xterm@^4.6.0-beta.17: + version "4.6.0-beta.17" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.6.0-beta.17.tgz#d3b448a7e09d65307f74ca862ce50847da891d89" + integrity sha512-/lG3pWSjejqPd58SSa1C24h3yarZkyVHefCt+3K2fqpV7EQTSnzl67RH3k/ojIflIX9d/JUQRqp/GGWnyyb2JQ== yallist@^2.1.2: version "2.1.2" From ab1b8a4500fe67a5587d1cd00e50799d358152d5 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Tue, 21 Apr 2020 09:17:26 +0200 Subject: [PATCH 5/5] added tab split commands to context menu - fixes #1321 --- .../src/components/baseTab.component.ts | 5 ++++ .../src/components/splitTab.component.ts | 4 ++- terminus-core/src/index.ts | 4 +-- terminus-core/src/tabContextMenu.ts | 29 ++++++++++++++++--- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/terminus-core/src/components/baseTab.component.ts b/terminus-core/src/components/baseTab.component.ts index b67ddadc..fea8b950 100644 --- a/terminus-core/src/components/baseTab.component.ts +++ b/terminus-core/src/components/baseTab.component.ts @@ -14,6 +14,11 @@ export interface BaseTabProcess { * Abstract base class for custom tab components */ export abstract class BaseTabComponent { + /** + * Parent tab (usually a SplitTabComponent) + */ + parent: BaseTabComponent|null = null + /** * Current tab title */ diff --git a/terminus-core/src/components/splitTab.component.ts b/terminus-core/src/components/splitTab.component.ts index 0624ae3a..af02dbcd 100644 --- a/terminus-core/src/components/splitTab.component.ts +++ b/terminus-core/src/components/splitTab.component.ts @@ -358,6 +358,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit this.attachTabView(tab) setImmediate(() => { + tab.parent = this this.layout() this.tabAdded.next(tab) this.focus(tab) @@ -374,11 +375,11 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit parent.children.splice(index, 1) this.detachTabView(tab) + tab.parent = null this.layout() this.tabRemoved.next(tab) - if (this.root.children.length === 0) { this.destroy() } else { @@ -569,6 +570,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit if (recovered) { const tab = this.tabsService.create(recovered.type, recovered.options) children.push(tab) + tab.parent = this this.attachTabView(tab) } else { state.ratios.splice(state.children.indexOf(childState), 0) diff --git a/terminus-core/src/index.ts b/terminus-core/src/index.ts index 83c1eb1e..6dbb0052 100644 --- a/terminus-core/src/index.ts +++ b/terminus-core/src/index.ts @@ -36,7 +36,7 @@ import { ConfigService } from './services/config.service' import { StandardTheme, StandardCompactTheme, PaperTheme } from './theme' import { CoreConfigProvider } from './config' import { AppHotkeyProvider } from './hotkeys' -import { TaskCompletionContextMenu, CommonOptionsContextMenu, CloseContextMenu } from './tabContextMenu' +import { TaskCompletionContextMenu, CommonOptionsContextMenu, TabManagementContextMenu } from './tabContextMenu' import 'perfect-scrollbar/css/perfect-scrollbar.css' import 'ng2-dnd/bundles/style.css' @@ -54,7 +54,7 @@ const PROVIDERS = [ { provide: Theme, useClass: PaperTheme, multi: true }, { provide: ConfigProvider, useClass: CoreConfigProvider, multi: true }, { provide: TabContextMenuItemProvider, useClass: CommonOptionsContextMenu, multi: true }, - { provide: TabContextMenuItemProvider, useClass: CloseContextMenu, multi: true }, + { provide: TabContextMenuItemProvider, useClass: TabManagementContextMenu, multi: true }, { provide: TabContextMenuItemProvider, useClass: TaskCompletionContextMenu, multi: true }, { provide: TabRecoveryProvider, useClass: SplitTabRecoveryProvider, multi: true }, { provide: PERFECT_SCROLLBAR_CONFIG, useValue: { suppressScrollX: true } }, diff --git a/terminus-core/src/tabContextMenu.ts b/terminus-core/src/tabContextMenu.ts index f03b1b68..0f556312 100644 --- a/terminus-core/src/tabContextMenu.ts +++ b/terminus-core/src/tabContextMenu.ts @@ -4,11 +4,12 @@ import { Subscription } from 'rxjs' import { AppService } from './services/app.service' import { BaseTabComponent } from './components/baseTab.component' import { TabHeaderComponent } from './components/tabHeader.component' +import { SplitTabComponent, SplitDirection } from './components/splitTab.component' import { TabContextMenuItemProvider } from './api/tabContextMenuProvider' /** @hidden */ @Injectable() -export class CloseContextMenu extends TabContextMenuItemProvider { +export class TabManagementContextMenu extends TabContextMenuItemProvider { weight = -5 constructor ( @@ -19,7 +20,7 @@ export class CloseContextMenu extends TabContextMenuItemProvider { } async getItems (tab: BaseTabComponent, tabHeader?: TabHeaderComponent): Promise { - let items = [ + let items: Electron.MenuItemConstructorOptions[] = [ { label: 'Close', click: () => this.zone.run(() => { @@ -59,6 +60,24 @@ export class CloseContextMenu extends TabContextMenuItemProvider { }), }, ] + } else { + if (tab.parent instanceof SplitTabComponent) { + const directions: SplitDirection[] = ['r', 'b', 'l', 't'] + items.push({ + label: 'Split', + submenu: directions.map(dir => ({ + label: { + r: 'Right', + b: 'Down', + l: 'Left', + t: 'Up', + }[dir], + click: () => this.zone.run(() => { + (tab.parent as SplitTabComponent).splitTab(tab, dir) + }), + })) as Electron.MenuItemConstructorOptions[], + }) + } } return items } @@ -87,8 +106,10 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider { } async getItems (tab: BaseTabComponent, tabHeader?: TabHeaderComponent): Promise { + let items: Electron.MenuItemConstructorOptions[] = [] if (tabHeader) { - return [ + items = [ + ...items, { label: 'Rename', click: () => this.zone.run(() => tabHeader?.showRenameTabModal()), @@ -111,7 +132,7 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider { }, ] } - return [] + return items } }