use profiles for everything

This commit is contained in:
Eugene Pankov
2019-05-11 21:28:04 +02:00
parent bc71547d92
commit 48ff7d7d5a
26 changed files with 159 additions and 101 deletions

View File

@@ -2,17 +2,17 @@ h3.mb-3 Shell
.form-line
.header
.title Shell
.description Default shell for new tabs
.title Profile
.description Default profile for new tabs
select.form-control(
[(ngModel)]='config.store.terminal.shell',
[(ngModel)]='config.store.terminal.profile',
(ngModelChange)='config.save()',
)
option(
*ngFor='let shell of shells',
[ngValue]='shell.id'
) {{shell.name}}
*ngFor='let profile of profiles',
[ngValue]='slug(profile.name)'
) {{profile.name}}
.form-line(*ngIf='isConPTYAvailable')
@@ -28,10 +28,10 @@ h3.mb-3 Shell
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.useConPTY && isConPTYAvailable && !isConPTYStable')
.mr-auto Windows 10 build 18309 or above is recommended for ConPTY
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.shell.startsWith("wsl") && (config.store.terminal.frontend != "hterm" || !config.store.terminal.useConPTY)')
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.profile.startsWith("WSL") && (config.store.terminal.frontend != "hterm" || !config.store.terminal.useConPTY)')
.mr-auto WSL terminal only supports TrueColor with ConPTY and the hterm frontend
.form-line(*ngIf='config.store.terminal.shell == "custom"')
.form-line(*ngIf='config.store.terminal.profile == "Custom shell"')
.header
.title Custom shell
@@ -66,7 +66,7 @@ h3.mt-3 Saved Profiles
.list-group.list-group-flush.mt-3.mb-3
.list-group-item.list-group-item-action.d-flex.align-items-center(
*ngFor='let profile of profiles',
*ngFor='let profile of config.store.terminal.profiles',
(click)='editProfile(profile)',
)
.mr-auto

View File

@@ -1,3 +1,4 @@
import slug from 'slug'
import { Component } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { Subscription } from 'rxjs'
@@ -17,6 +18,7 @@ export class ShellSettingsTabComponent {
Platform = Platform
isConPTYAvailable: boolean
isConPTYStable: boolean
slug = slug
private configSubscription: Subscription
constructor (
@@ -44,13 +46,12 @@ export class ShellSettingsTabComponent {
this.configSubscription.unsubscribe()
}
reload () {
this.profiles = this.config.store.terminal.profiles
async reload () {
this.profiles = await this.terminalService.getProfiles()
}
pickWorkingDirectory () {
let shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
console.log(shell)
let paths = this.electron.dialog.showOpenDialog(
this.hostApp.getWindow(),
{
@@ -68,9 +69,9 @@ export class ShellSettingsTabComponent {
name: shell.name,
sessionOptions: this.terminalService.optionsFromShell(shell),
}
this.profiles.push(profile)
this.config.store.terminal.profiles = this.profiles
this.config.store.terminal.profiles = [profile, ...this.config.store.terminal.profiles]
this.config.save()
this.reload()
}
editProfile (profile: Profile) {
@@ -83,8 +84,8 @@ export class ShellSettingsTabComponent {
}
deleteProfile (profile: Profile) {
this.profiles = this.profiles.filter(x => x !== profile)
this.config.store.terminal.profiles = this.profiles
this.config.store.terminal.profiles = this.config.store.terminal.profiles.filter(x => x !== profile)
this.config.save()
this.reload()
}
}

View File

@@ -16,9 +16,11 @@ export class TerminalSettingsTabComponent {
openWSLVolumeMixer () {
this.electron.shell.openItem('sndvol.exe')
this.terminal.openTab({
id: '',
command: 'wsl.exe',
args: ['tput', 'bel'],
name: null,
sessionOptions: {
command: 'wsl.exe',
args: ['tput', 'bel'],
},
}, null, true)
}
}