mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
#7315 - added terminal identification option on windows
This commit is contained in:
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'
|
- 'Ctrl-Shift-E'
|
||||||
command-selector:
|
command-selector:
|
||||||
- 'Ctrl-Shift-P'
|
- 'Ctrl-Shift-P'
|
||||||
|
terminal:
|
||||||
|
identification: wt
|
||||||
|
@@ -23,6 +23,7 @@ terminal:
|
|||||||
showRecentProfiles: 3
|
showRecentProfiles: 3
|
||||||
paneResizeStep: 0.1
|
paneResizeStep: 0.1
|
||||||
focusFollowsMouse: false
|
focusFollowsMouse: false
|
||||||
|
identification: null
|
||||||
hotkeys:
|
hotkeys:
|
||||||
profile:
|
profile:
|
||||||
__nonStructural: true
|
__nonStructural: true
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { Injectable } from '@angular/core'
|
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 */
|
/* eslint-disable block-scoped-var */
|
||||||
|
|
||||||
@@ -12,11 +13,13 @@ try {
|
|||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GitBashShellProvider extends ShellProvider {
|
export class GitBashShellProvider extends WindowsBaseShellProvider {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||||
constructor (
|
constructor (
|
||||||
private hostApp: HostAppService,
|
hostApp: HostAppService,
|
||||||
|
config: ConfigService,
|
||||||
) {
|
) {
|
||||||
super()
|
super(hostApp, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
async provide (): Promise<Shell[]> {
|
async provide (): Promise<Shell[]> {
|
||||||
@@ -40,9 +43,7 @@ export class GitBashShellProvider extends ShellProvider {
|
|||||||
command: path.join(gitBashPath, 'bin', 'bash.exe'),
|
command: path.join(gitBashPath, 'bin', 'bash.exe'),
|
||||||
args: ['--login', '-i'],
|
args: ['--login', '-i'],
|
||||||
icon: require('../icons/git-bash.svg'),
|
icon: require('../icons/git-bash.svg'),
|
||||||
env: {
|
env: this.getEnvironment(),
|
||||||
TERM: 'cygwin',
|
|
||||||
},
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core'
|
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 */
|
/* eslint-disable block-scoped-var */
|
||||||
|
|
||||||
@@ -11,11 +12,13 @@ try {
|
|||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PowerShellCoreShellProvider extends ShellProvider {
|
export class PowerShellCoreShellProvider extends WindowsBaseShellProvider {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||||
constructor (
|
constructor (
|
||||||
private hostApp: HostAppService,
|
hostApp: HostAppService,
|
||||||
|
config: ConfigService,
|
||||||
) {
|
) {
|
||||||
super()
|
super(hostApp, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
async provide (): Promise<Shell[]> {
|
async provide (): Promise<Shell[]> {
|
||||||
@@ -35,9 +38,7 @@ export class PowerShellCoreShellProvider extends ShellProvider {
|
|||||||
command: pwshPath,
|
command: pwshPath,
|
||||||
args: ['-nologo'],
|
args: ['-nologo'],
|
||||||
icon: require('../icons/powershell-core.svg'),
|
icon: require('../icons/powershell-core.svg'),
|
||||||
env: {
|
env: this.getEnvironment(),
|
||||||
TERM: 'cygwin',
|
|
||||||
},
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,6 @@ export class WindowsDefaultShellProvider extends ShellProvider {
|
|||||||
id: 'default',
|
id: 'default',
|
||||||
name: this.translate.instant('OS default ({name})', shell),
|
name: this.translate.instant('OS default ({name})', shell),
|
||||||
hidden: true,
|
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 * as fs from 'fs/promises'
|
||||||
import hasbin from 'hasbin'
|
import hasbin from 'hasbin'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { HostAppService, Platform } from 'tabby-core'
|
import { HostAppService, Platform, ConfigService } from 'tabby-core'
|
||||||
import { ElectronService } from 'tabby-electron'
|
import { ElectronService } from 'tabby-electron'
|
||||||
|
|
||||||
import { ShellProvider, Shell } from '../api'
|
import { Shell } from '../api'
|
||||||
|
import { WindowsBaseShellProvider } from './windowsBase'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WindowsStockShellsProvider extends ShellProvider {
|
export class WindowsStockShellsProvider extends WindowsBaseShellProvider {
|
||||||
constructor (
|
constructor (
|
||||||
private hostApp: HostAppService,
|
hostApp: HostAppService,
|
||||||
|
config: ConfigService,
|
||||||
private electron: ElectronService,
|
private electron: ElectronService,
|
||||||
) {
|
) {
|
||||||
super()
|
super(hostApp, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
async provide (): Promise<Shell[]> {
|
async provide (): Promise<Shell[]> {
|
||||||
@@ -64,9 +66,7 @@ export class WindowsStockShellsProvider extends ShellProvider {
|
|||||||
command: await this.getPowerShellPath(),
|
command: await this.getPowerShellPath(),
|
||||||
args: ['-nologo'],
|
args: ['-nologo'],
|
||||||
icon: require('../icons/powershell.svg'),
|
icon: require('../icons/powershell.svg'),
|
||||||
env: {
|
env: this.getEnvironment(),
|
||||||
TERM: 'cygwin',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -108,6 +108,18 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
|
|||||||
(ngModelChange)='config.save()'
|
(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
|
.form-line.content-box
|
||||||
.header
|
.header
|
||||||
.title(translate) Default profile settings
|
.title(translate) Default profile settings
|
||||||
|
@@ -4,7 +4,7 @@ import slugify from 'slugify'
|
|||||||
import deepClone from 'clone-deep'
|
import deepClone from 'clone-deep'
|
||||||
import { Component, Inject } from '@angular/core'
|
import { Component, Inject } from '@angular/core'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
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'
|
import { EditProfileModalComponent } from './editProfileModal.component'
|
||||||
|
|
||||||
interface ProfileGroup {
|
interface ProfileGroup {
|
||||||
@@ -28,6 +28,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
|||||||
templateProfiles: PartialProfile<Profile>[] = []
|
templateProfiles: PartialProfile<Profile>[] = []
|
||||||
profileGroups: ProfileGroup[]
|
profileGroups: ProfileGroup[]
|
||||||
filter = ''
|
filter = ''
|
||||||
|
Platform = Platform
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
public config: ConfigService,
|
public config: ConfigService,
|
||||||
|
Reference in New Issue
Block a user