mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-15 00:50:03 +00:00
Added ability to configure whether new terminals will always open with the configured working directory
This commit is contained in:
parent
1d1e620db6
commit
2848f9f257
@ -55,6 +55,16 @@ h3.mb-3 Shell
|
|||||||
button.btn.btn-secondary((click)='pickWorkingDirectory()')
|
button.btn.btn-secondary((click)='pickWorkingDirectory()')
|
||||||
i.fas.fa-folder-open
|
i.fas.fa-folder-open
|
||||||
|
|
||||||
|
.form-line
|
||||||
|
.header
|
||||||
|
.title Always Use Working Directory
|
||||||
|
.description By default, new terminals will open where the previous terminal was working. Enabling this option will always launch new terminals in the working directory specified above.
|
||||||
|
|
||||||
|
toggle(
|
||||||
|
[(ngModel)]='config.store.terminal.alwaysUseWorkingDirectory',
|
||||||
|
(ngModelChange)='config.save()'
|
||||||
|
)
|
||||||
|
|
||||||
.form-line.align-items-start
|
.form-line.align-items-start
|
||||||
.header
|
.header
|
||||||
.title Environment
|
.title Environment
|
||||||
|
@ -27,6 +27,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
|||||||
copyOnSelect: false,
|
copyOnSelect: false,
|
||||||
scrollOnInput: true,
|
scrollOnInput: true,
|
||||||
workingDirectory: '',
|
workingDirectory: '',
|
||||||
|
alwaysUseWorkingDirectory: false,
|
||||||
altIsMeta: false,
|
altIsMeta: false,
|
||||||
colorScheme: {
|
colorScheme: {
|
||||||
__nonStructural: true,
|
__nonStructural: true,
|
||||||
|
@ -35,7 +35,9 @@ export class NewTabContextMenu extends TerminalContextMenuItemProvider {
|
|||||||
submenu: profiles.map(profile => ({
|
submenu: profiles.map(profile => ({
|
||||||
label: profile.name,
|
label: profile.name,
|
||||||
click: () => this.zone.run(async () => {
|
click: () => this.zone.run(async () => {
|
||||||
this.terminalService.openTab(profile, await tab.session.getWorkingDirectory())
|
const workingDirectory = this.config.store.terminal.alwaysUseWorkingDirectory ?
|
||||||
|
this.config.store.terminal.workingDirectory : await tab.session.getWorkingDirectory();
|
||||||
|
this.terminalService.openTab(profile, workingDirectory);
|
||||||
}),
|
}),
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
@ -65,14 +65,16 @@ export class TerminalService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cwd) {
|
if (!cwd) {
|
||||||
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
|
if (!this.config.store.terminal.alwaysUseWorkingDirectory) {
|
||||||
cwd = await this.app.activeTab.session.getWorkingDirectory()
|
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
|
||||||
}
|
cwd = await this.app.activeTab.session.getWorkingDirectory()
|
||||||
if (this.app.activeTab instanceof SplitTabComponent) {
|
}
|
||||||
const focusedTab = this.app.activeTab.getFocusedTab()
|
if (this.app.activeTab instanceof SplitTabComponent) {
|
||||||
|
const focusedTab = this.app.activeTab.getFocusedTab()
|
||||||
|
|
||||||
if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
|
if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
|
||||||
cwd = await focusedTab.session.getWorkingDirectory()
|
cwd = await focusedTab.session.getWorkingDirectory()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cwd = cwd || this.config.store.terminal.workingDirectory
|
cwd = cwd || this.config.store.terminal.workingDirectory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user