mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-09 06:20:22 +08:00
autoselect tmux
This commit is contained in:
parent
23dabca2ab
commit
c0c2b693f3
@ -48,7 +48,12 @@ import { hterm } from './hterm'
|
||||
if (hostApp.platform === Platform.Windows) {
|
||||
return null
|
||||
} else {
|
||||
return tmux
|
||||
if (tmux.isAvailable()) {
|
||||
tmux.init()
|
||||
return tmux
|
||||
} else {
|
||||
return screen
|
||||
}
|
||||
}
|
||||
},
|
||||
deps: [HostAppService, ScreenPersistenceProvider, TMuxPersistenceProvider],
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { execFileSync } from 'child_process'
|
||||
import * as AsyncLock from 'async-lock'
|
||||
import { ConnectableObservable, Subject } from 'rxjs'
|
||||
import * as childProcess from 'child_process'
|
||||
@ -166,6 +167,18 @@ export class TMuxPersistenceProvider extends SessionPersistenceProvider {
|
||||
|
||||
constructor () {
|
||||
super()
|
||||
}
|
||||
|
||||
isAvailable (): boolean {
|
||||
try {
|
||||
execFileSync('tmux', ['-V'])
|
||||
return true
|
||||
} catch (_) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
init () {
|
||||
this.tmux = new TMux()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user