mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 22:44:55 +00:00
better messageboxes
This commit is contained in:
@@ -5,7 +5,7 @@ import deepEqual = require('deep-equal')
|
||||
const fontManager = require('font-manager')
|
||||
|
||||
import { Component, Inject } from '@angular/core'
|
||||
import { ConfigService, HostAppService, Platform } from 'terminus-core'
|
||||
import { ConfigService, HostAppService, Platform, ElectronService } from 'terminus-core'
|
||||
import { TerminalColorSchemeProvider, ITerminalColorScheme } from '../api'
|
||||
|
||||
@Component({
|
||||
@@ -22,6 +22,7 @@ export class AppearanceSettingsTabComponent {
|
||||
constructor (
|
||||
@Inject(TerminalColorSchemeProvider) private colorSchemeProviders: TerminalColorSchemeProvider[],
|
||||
private hostApp: HostAppService,
|
||||
private electron: ElectronService,
|
||||
public config: ConfigService,
|
||||
) { }
|
||||
|
||||
@@ -71,8 +72,16 @@ export class AppearanceSettingsTabComponent {
|
||||
this.editingColorScheme = null
|
||||
}
|
||||
|
||||
deleteScheme (scheme: ITerminalColorScheme) {
|
||||
if (confirm(`Delete "${scheme.name}"?`)) {
|
||||
async deleteScheme (scheme: ITerminalColorScheme) {
|
||||
if ((await this.electron.showMessageBox(
|
||||
this.hostApp.getWindow(),
|
||||
{
|
||||
type: 'warning',
|
||||
message: `Delete "${scheme.name}"?`,
|
||||
buttons: ['Keep', 'Delete'],
|
||||
defaultId: 1,
|
||||
}
|
||||
)).response === 1) {
|
||||
let schemes = this.config.store.terminal.customColorSchemes
|
||||
schemes = schemes.filter(x => x !== scheme)
|
||||
this.config.store.terminal.customColorSchemes = schemes
|
||||
|
@@ -48,10 +48,13 @@ export class ShellSettingsTabComponent {
|
||||
pickWorkingDirectory () {
|
||||
let shell = this.shells.find(x => x.id === this.config.store.terminal.shell)
|
||||
console.log(shell)
|
||||
let paths = this.electron.dialog.showOpenDialog({
|
||||
defaultPath: shell.fsBase,
|
||||
properties: ['openDirectory', 'showHiddenFiles'],
|
||||
})
|
||||
let paths = this.electron.dialog.showOpenDialog(
|
||||
this.hostApp.getWindow(),
|
||||
{
|
||||
defaultPath: shell.fsBase,
|
||||
properties: ['openDirectory', 'showHiddenFiles'],
|
||||
}
|
||||
)
|
||||
if (paths) {
|
||||
this.config.store.terminal.workingDirectory = paths[0]
|
||||
}
|
||||
|
@@ -380,7 +380,15 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
if (children.length === 0) {
|
||||
return true
|
||||
}
|
||||
return confirm(`"${children[0].command}" is still running. Close?`)
|
||||
return (await this.electron.showMessageBox(
|
||||
this.hostApp.getWindow(),
|
||||
{
|
||||
type: 'warning',
|
||||
message: `"${children[0].command}" is still running. Close?`,
|
||||
buttons: ['Cancel', 'Kill'],
|
||||
defaultId: 1,
|
||||
}
|
||||
)).response === 1
|
||||
}
|
||||
|
||||
async saveAsProfile () {
|
||||
|
Reference in New Issue
Block a user