diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index 065011a5..c275ab1d 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -311,6 +311,33 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit case 'pane-nav-next': this.navigateLinear(1) break + case 'pane-nav-1': + this.navigateSpecific(0) + break + case 'pane-nav-2': + this.navigateSpecific(1) + break + case 'pane-nav-3': + this.navigateSpecific(2) + break + case 'pane-nav-4': + this.navigateSpecific(3) + break + case 'pane-nav-5': + this.navigateSpecific(4) + break + case 'pane-nav-6': + this.navigateSpecific(5) + break + case 'pane-nav-7': + this.navigateSpecific(6) + break + case 'pane-nav-8': + this.navigateSpecific(7) + break + case 'pane-nav-9': + this.navigateSpecific(8) + break case 'pane-maximize': if (this.maximizedTab) { this.maximize(null) @@ -644,6 +671,15 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit this.focus(target) } + navigateSpecific (target: number): void { + const all = this.getAllTabs() + if (target >= all.length) { + return + } + + this.focus(all[target]) + } + async splitTab (tab: BaseTabComponent, dir: SplitDirection): Promise { const newTab = await this.tabsService.duplicate(tab) if (newTab) { @@ -763,6 +799,9 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit const ref = tab.insertIntoContainer(this.viewContainer) this.viewRefs.set(tab, ref) tab.addEventListenerUntilDestroyed(ref.rootNodes[0], 'click', () => this.focus(tab)) + if (this.config.store.terminal.focusFollowsMouse) { + tab.addEventListenerUntilDestroyed(ref.rootNodes[0], 'mousemove', () => this.focus(tab)) + } tab.subscribeUntilDestroyed(tab.titleChange$, () => this.updateTitle()) tab.subscribeUntilDestroyed(tab.activity$, a => a ? this.displayActivity() : this.clearActivity()) diff --git a/tabby-core/src/configDefaults.linux.yaml b/tabby-core/src/configDefaults.linux.yaml index 1cd5ef7b..cadb4160 100644 --- a/tabby-core/src/configDefaults.linux.yaml +++ b/tabby-core/src/configDefaults.linux.yaml @@ -73,6 +73,15 @@ hotkeys: - 'Ctrl-Alt-[' pane-nav-next: - 'Ctrl-Alt-]' + pane-nav-1: [] + pane-nav-2: [] + pane-nav-3: [] + pane-nav-4: [] + pane-nav-5: [] + pane-nav-6: [] + pane-nav-7: [] + pane-nav-8: [] + pane-nav-9: [] pane-maximize: - 'Ctrl-Alt-Enter' pane-increase-vertical: [] diff --git a/tabby-core/src/configDefaults.macos.yaml b/tabby-core/src/configDefaults.macos.yaml index c4bf2867..620471df 100644 --- a/tabby-core/src/configDefaults.macos.yaml +++ b/tabby-core/src/configDefaults.macos.yaml @@ -71,6 +71,15 @@ hotkeys: - '⌘-⌥-[' pane-nav-next: - '⌘-⌥-]' + pane-nav-1: [] + pane-nav-2: [] + pane-nav-3: [] + pane-nav-4: [] + pane-nav-5: [] + pane-nav-6: [] + pane-nav-7: [] + pane-nav-8: [] + pane-nav-9: [] pane-maximize: - '⌘-⌥-Enter' close-pane: diff --git a/tabby-core/src/configDefaults.windows.yaml b/tabby-core/src/configDefaults.windows.yaml index 1f334e0c..19293b87 100644 --- a/tabby-core/src/configDefaults.windows.yaml +++ b/tabby-core/src/configDefaults.windows.yaml @@ -74,6 +74,15 @@ hotkeys: - 'Ctrl-Alt-[' pane-nav-next: - 'Ctrl-Alt-]' + pane-nav-1: [] + pane-nav-2: [] + pane-nav-3: [] + pane-nav-4: [] + pane-nav-5: [] + pane-nav-6: [] + pane-nav-7: [] + pane-nav-8: [] + pane-nav-9: [] pane-maximize: - 'Ctrl-Alt-Enter' close-pane: [] diff --git a/tabby-core/src/configDefaults.yaml b/tabby-core/src/configDefaults.yaml index 823506e5..a4cd8be9 100644 --- a/tabby-core/src/configDefaults.yaml +++ b/tabby-core/src/configDefaults.yaml @@ -20,6 +20,7 @@ terminal: showBuiltinProfiles: true showRecentProfiles: 3 paneResizeStep: 0.1 + focusFollowsMouse: false hotkeys: profile: __nonStructural: true diff --git a/tabby-core/src/hotkeys.ts b/tabby-core/src/hotkeys.ts index 9d73272b..e35f662f 100644 --- a/tabby-core/src/hotkeys.ts +++ b/tabby-core/src/hotkeys.ts @@ -188,6 +188,42 @@ export class AppHotkeyProvider extends HotkeyProvider { id: 'pane-nav-next', name: this.translate.instant('Focus next pane'), }, + { + id: 'pane-nav-1', + name: this.translate.instant('Focus pane {number}', { number: 1 }), + }, + { + id: 'pane-nav-2', + name: this.translate.instant('Focus pane {number}', { number: 2 }), + }, + { + id: 'pane-nav-3', + name: this.translate.instant('Focus pane {number}', { number: 3 }), + }, + { + id: 'pane-nav-4', + name: this.translate.instant('Focus pane {number}', { number: 4 }), + }, + { + id: 'pane-nav-5', + name: this.translate.instant('Focus pane {number}', { number: 5 }), + }, + { + id: 'pane-nav-6', + name: this.translate.instant('Focus pane {number}', { number: 6 }), + }, + { + id: 'pane-nav-7', + name: this.translate.instant('Focus pane {number}', { number: 7 }), + }, + { + id: 'pane-nav-8', + name: this.translate.instant('Focus pane {number}', { number: 8 }), + }, + { + id: 'pane-nav-9', + name: this.translate.instant('Focus pane {number}', { number: 9 }), + }, { id: 'switch-profile', name: this.translate.instant('Switch profile in the active pane'), diff --git a/tabby-settings/src/components/windowSettingsTab.component.pug b/tabby-settings/src/components/windowSettingsTab.component.pug index 5dd1c5b3..b90752f1 100644 --- a/tabby-settings/src/components/windowSettingsTab.component.pug +++ b/tabby-settings/src/components/windowSettingsTab.component.pug @@ -319,6 +319,15 @@ h3.mt-4(translate) Panes step='0.05' ) +.form-line() + .header + .title(translate) Focus follows mouse + .description(translate) Moving the mouse over an inactive pane will cause it to activate + toggle( + [(ngModel)]='config.store.terminal.focusFollowsMouse', + (ngModelChange)='config.save(); config.requestRestart()' + ) + h3.mt-4(translate) Hacks .form-line