From a98050b1cd6d023853e7d17c443ab8f91bcef2d6 Mon Sep 17 00:00:00 2001 From: Atte Timonen Date: Thu, 19 May 2022 18:05:22 +0200 Subject: [PATCH] Implement 'focus follows mouse' for pane navigation --- tabby-core/src/components/splitTab.component.ts | 3 +++ tabby-core/src/configDefaults.yaml | 1 + .../src/components/windowSettingsTab.component.pug | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index 54f223ca..c275ab1d 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -799,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.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-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