started separating terminus-electron and terminus-web

This commit is contained in:
Eugene Pankov
2021-05-24 17:48:12 +02:00
parent c19e131d8c
commit 012986dc7e
94 changed files with 1899 additions and 972 deletions

View File

@@ -67,6 +67,7 @@ export class HotkeyInputModalComponent extends BaseComponent {
}
this.timeoutProgress = Math.min(100, (performance.now() - this.lastKeyEvent) * 100 / INPUT_TIMEOUT)
if (this.timeoutProgress === 100) {
clearInterval(this.keyTimeoutInterval!)
this.modalInstance.close(this.value)
}
}, 25)
@@ -74,13 +75,14 @@ export class HotkeyInputModalComponent extends BaseComponent {
}
ngOnDestroy (): void {
clearInterval(this.keyTimeoutInterval!)
this.hotkeys.clearCurrentKeystrokes()
this.hotkeys.enable()
clearInterval(this.keyTimeoutInterval!)
super.ngOnDestroy()
}
close (): void {
clearInterval(this.keyTimeoutInterval!)
this.modalInstance.dismiss()
}
}

View File

@@ -40,7 +40,7 @@ button.btn.btn-outline-warning.btn-block(*ngIf='config.restartRequested', '(clic
i.fas.fa-sync
span Update
.form-line(*ngIf='hostApp.platform !== Platform.Linux')
.form-line(*ngIf='platform.isShellIntegrationSupported()')
.header
.title Shell integration
.description Allows quickly opening a terminal in the selected folder
@@ -101,7 +101,10 @@ button.btn.btn-outline-warning.btn-block(*ngIf='config.restartRequested', '(clic
button.btn.btn-primary(disabled, *ngIf='!isConfigFileValid()')
i.fas.fa-exclamation-triangle.mr-2
| Invalid syntax
button.btn.btn-secondary.ml-auto((click)='showConfigFile()')
button.btn.btn-secondary.ml-auto(
*ngIf='platform.getConfigPath()',
(click)='showConfigFile()'
)
i.fas.fa-external-link-square-alt.mr-2
| Show config file

View File

@@ -3,14 +3,13 @@ import * as yaml from 'js-yaml'
import { debounce } from 'utils-decorators/dist/cjs'
import { Component, Inject, Input, HostBinding, NgZone } from '@angular/core'
import {
ElectronService,
ConfigService,
BaseTabComponent,
HostAppService,
Platform,
HomeBaseService,
ShellIntegrationService,
UpdaterService,
PlatformService,
} from 'terminus-core'
import { SettingsTabProvider } from '../api'
@@ -35,10 +34,9 @@ export class SettingsTabComponent extends BaseTabComponent {
constructor (
public config: ConfigService,
private electron: ElectronService,
public hostApp: HostAppService,
public homeBase: HomeBaseService,
public shellIntegration: ShellIntegrationService,
public platform: PlatformService,
public zone: NgZone,
private updater: UpdaterService,
@Inject(SettingsTabProvider) public settingsProviders: SettingsTabProvider[],
@@ -61,16 +59,16 @@ export class SettingsTabComponent extends BaseTabComponent {
}
async ngOnInit () {
this.isShellIntegrationInstalled = await this.shellIntegration.isInstalled()
this.isShellIntegrationInstalled = await this.platform.isShellIntegrationInstalled()
}
async toggleShellIntegration () {
if (!this.isShellIntegrationInstalled) {
await this.shellIntegration.install()
await this.platform.installShellIntegration()
} else {
await this.shellIntegration.remove()
await this.platform.uninstallShellIntegration()
}
this.isShellIntegrationInstalled = await this.shellIntegration.isInstalled()
this.isShellIntegrationInstalled = await this.platform.isShellIntegrationInstalled()
}
ngOnDestroy () {
@@ -96,7 +94,7 @@ export class SettingsTabComponent extends BaseTabComponent {
}
showConfigFile () {
this.electron.shell.showItemInFolder(this.config.path)
this.platform.showItemInFolder(this.platform.getConfigPath()!)
}
isConfigFileValid () {

View File

@@ -9,7 +9,7 @@ h3.mb-3 Window
)
option(*ngFor='let theme of themes', [ngValue]='theme.name') {{theme.name}}
.form-line
.form-line(*ngIf='platform.supportsWindowControls')
.header
.title(*ngIf='hostApp.platform !== Platform.macOS') Acrylic background
.title(*ngIf='hostApp.platform === Platform.macOS') Vibrancy
@@ -43,7 +43,7 @@ h3.mb-3 Window
)
| Fluent
.form-line
.form-line(*ngIf='platform.supportsWindowControls')
.header
.title Opacity
input(
@@ -55,7 +55,7 @@ h3.mb-3 Window
step='0.01'
)
.form-line
.form-line(*ngIf='platform.supportsWindowControls')
.header
.title Window frame
.description Whether a custom window or an OS native window should be used
@@ -87,7 +87,7 @@ h3.mb-3 Window
)
| Full
.form-line
.form-line(*ngIf='docking')
.header
.title Dock the terminal
.description Snaps the window to a side of the screen
@@ -133,7 +133,7 @@ h3.mb-3 Window
)
| Bottom
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='docking && config.store.appearance.dock != "off"')
.header
.title Display on
.description Snaps the window to a side of the screen
@@ -158,7 +158,7 @@ h3.mb-3 Window
)
| {{screen.name}}
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='docking && config.store.appearance.dock != "off"')
.header
.title Dock always on top
.description Keep docked terminal always on top
@@ -167,7 +167,7 @@ h3.mb-3 Window
(ngModelChange)='saveConfiguration(); docking.dock()',
)
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='docking && config.store.appearance.dock != "off"')
.header
.title Docked terminal size
input(
@@ -179,7 +179,7 @@ h3.mb-3 Window
step='0.01'
)
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='docking && config.store.appearance.dock != "off"')
.header
.title Docked terminal space
input(
@@ -191,7 +191,7 @@ h3.mb-3 Window
step='0.01'
)
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='docking && config.store.appearance.dock != "off"')
.header
.title Hide dock on blur
.description Hides the docked terminal when you click away.

View File

@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { debounce } from 'utils-decorators/dist/cjs'
import { Component, Inject, NgZone } from '@angular/core'
import { Component, Inject, NgZone, Optional } from '@angular/core'
import {
DockingService,
ConfigService,
@@ -10,6 +10,8 @@ import {
isWindowsBuild,
WIN_BUILD_FLUENT_BG_SUPPORTED,
BaseComponent,
Screen,
PlatformService,
} from 'terminus-core'
@@ -19,24 +21,28 @@ import {
template: require('./windowSettingsTab.component.pug'),
})
export class WindowSettingsTabComponent extends BaseComponent {
screens: any[]
screens: Screen[]
Platform = Platform
isFluentVibrancySupported = false
constructor (
public config: ConfigService,
public docking: DockingService,
public hostApp: HostAppService,
public platform: PlatformService,
public zone: NgZone,
@Inject(Theme) public themes: Theme[],
@Optional() public docking?: DockingService,
) {
super()
this.screens = this.docking.getScreens()
this.themes = config.enabledServices(this.themes)
this.subscribeUntilDestroyed(hostApp.displaysChanged$, () => {
this.zone.run(() => this.screens = this.docking.getScreens())
})
if (this.docking) {
this.subscribeUntilDestroyed(hostApp.displaysChanged$, () => {
this.zone.run(() => this.screens = this.docking!.getScreens())
})
this.screens = this.docking.getScreens()
}
this.isFluentVibrancySupported = isWindowsBuild(WIN_BUILD_FLUENT_BG_SUPPORTED)
}