mirror of
https://github.com/Eugeny/tabby.git
synced 2025-04-12 16:10:26 +08:00
#7315 - added terminal identification option on windows
This commit is contained in:
parent
5e2976ab3d
commit
842636aa15
2152
config.yaml
Normal file
2152
config.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -97,3 +97,5 @@ hotkeys:
|
||||
- 'Ctrl-Shift-E'
|
||||
command-selector:
|
||||
- 'Ctrl-Shift-P'
|
||||
terminal:
|
||||
identification: wt
|
||||
|
@ -23,6 +23,7 @@ terminal:
|
||||
showRecentProfiles: 3
|
||||
paneResizeStep: 0.1
|
||||
focusFollowsMouse: false
|
||||
identification: null
|
||||
hotkeys:
|
||||
profile:
|
||||
__nonStructural: true
|
||||
|
@ -1,8 +1,9 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'tabby-core'
|
||||
import { Platform, ConfigService, HostAppService } from 'tabby-core'
|
||||
|
||||
import { ShellProvider, Shell } from '../api'
|
||||
import { Shell } from '../api'
|
||||
import { WindowsBaseShellProvider } from './windowsBase'
|
||||
|
||||
/* eslint-disable block-scoped-var */
|
||||
|
||||
@ -12,11 +13,13 @@ try {
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
export class GitBashShellProvider extends ShellProvider {
|
||||
export class GitBashShellProvider extends WindowsBaseShellProvider {
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor (
|
||||
private hostApp: HostAppService,
|
||||
hostApp: HostAppService,
|
||||
config: ConfigService,
|
||||
) {
|
||||
super()
|
||||
super(hostApp, config)
|
||||
}
|
||||
|
||||
async provide (): Promise<Shell[]> {
|
||||
@ -40,9 +43,7 @@ export class GitBashShellProvider extends ShellProvider {
|
||||
command: path.join(gitBashPath, 'bin', 'bash.exe'),
|
||||
args: ['--login', '-i'],
|
||||
icon: require('../icons/git-bash.svg'),
|
||||
env: {
|
||||
TERM: 'cygwin',
|
||||
},
|
||||
env: this.getEnvironment(),
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'tabby-core'
|
||||
import { HostAppService, ConfigService, Platform } from 'tabby-core'
|
||||
|
||||
import { ShellProvider, Shell } from '../api'
|
||||
import { Shell } from '../api'
|
||||
import { WindowsBaseShellProvider } from './windowsBase'
|
||||
|
||||
/* eslint-disable block-scoped-var */
|
||||
|
||||
@ -11,11 +12,13 @@ try {
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
export class PowerShellCoreShellProvider extends ShellProvider {
|
||||
export class PowerShellCoreShellProvider extends WindowsBaseShellProvider {
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor (
|
||||
private hostApp: HostAppService,
|
||||
hostApp: HostAppService,
|
||||
config: ConfigService,
|
||||
) {
|
||||
super()
|
||||
super(hostApp, config)
|
||||
}
|
||||
|
||||
async provide (): Promise<Shell[]> {
|
||||
@ -35,9 +38,7 @@ export class PowerShellCoreShellProvider extends ShellProvider {
|
||||
command: pwshPath,
|
||||
args: ['-nologo'],
|
||||
icon: require('../icons/powershell-core.svg'),
|
||||
env: {
|
||||
TERM: 'cygwin',
|
||||
},
|
||||
env: this.getEnvironment(),
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ export class WindowsDefaultShellProvider extends ShellProvider {
|
||||
id: 'default',
|
||||
name: this.translate.instant('OS default ({name})', shell),
|
||||
hidden: true,
|
||||
env: {},
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
23
tabby-local/src/shells/windowsBase.ts
Normal file
23
tabby-local/src/shells/windowsBase.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ConfigService, HostAppService } from 'tabby-core'
|
||||
|
||||
import { ShellProvider } from '../api'
|
||||
|
||||
export abstract class WindowsBaseShellProvider extends ShellProvider {
|
||||
constructor (
|
||||
protected hostApp: HostAppService,
|
||||
protected config: ConfigService,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
protected getEnvironment (): any {
|
||||
return {
|
||||
wt: {
|
||||
WT_SESSION: 0,
|
||||
},
|
||||
cygwin: {
|
||||
TERM: 'cygwin',
|
||||
},
|
||||
}[this.config.store.terminal.identification] ?? {}
|
||||
}
|
||||
}
|
@ -2,19 +2,21 @@ import * as path from 'path'
|
||||
import * as fs from 'fs/promises'
|
||||
import hasbin from 'hasbin'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'tabby-core'
|
||||
import { HostAppService, Platform, ConfigService } from 'tabby-core'
|
||||
import { ElectronService } from 'tabby-electron'
|
||||
|
||||
import { ShellProvider, Shell } from '../api'
|
||||
import { Shell } from '../api'
|
||||
import { WindowsBaseShellProvider } from './windowsBase'
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
export class WindowsStockShellsProvider extends ShellProvider {
|
||||
export class WindowsStockShellsProvider extends WindowsBaseShellProvider {
|
||||
constructor (
|
||||
private hostApp: HostAppService,
|
||||
hostApp: HostAppService,
|
||||
config: ConfigService,
|
||||
private electron: ElectronService,
|
||||
) {
|
||||
super()
|
||||
super(hostApp, config)
|
||||
}
|
||||
|
||||
async provide (): Promise<Shell[]> {
|
||||
@ -64,9 +66,7 @@ export class WindowsStockShellsProvider extends ShellProvider {
|
||||
command: await this.getPowerShellPath(),
|
||||
args: ['-nologo'],
|
||||
icon: require('../icons/powershell.svg'),
|
||||
env: {
|
||||
TERM: 'cygwin',
|
||||
},
|
||||
env: this.getEnvironment(),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -108,6 +108,18 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
|
||||
(ngModelChange)='config.save()'
|
||||
)
|
||||
|
||||
.form-line.content-box(*ngIf='hostApp.platform === Platform.Windows')
|
||||
.header
|
||||
.title(translate) Terminal identification
|
||||
.description(translate) How Tabby presents itself through environment vars
|
||||
|
||||
select.form-control(
|
||||
[(ngModel)]='config.store.terminal.identification',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option(ngValue='wt', translation) Windows Terminal
|
||||
option(ngValue='cygwin', translation) Cygwin
|
||||
|
||||
.form-line.content-box
|
||||
.header
|
||||
.title(translate) Default profile settings
|
||||
|
@ -4,7 +4,7 @@ import slugify from 'slugify'
|
||||
import deepClone from 'clone-deep'
|
||||
import { Component, Inject } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService } from 'tabby-core'
|
||||
import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform } from 'tabby-core'
|
||||
import { EditProfileModalComponent } from './editProfileModal.component'
|
||||
|
||||
interface ProfileGroup {
|
||||
@ -28,6 +28,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
||||
templateProfiles: PartialProfile<Profile>[] = []
|
||||
profileGroups: ProfileGroup[]
|
||||
filter = ''
|
||||
Platform = Platform
|
||||
|
||||
constructor (
|
||||
public config: ConfigService,
|
||||
|
Loading…
x
Reference in New Issue
Block a user