fix: when new items enter the tabbed view they should be the active window

This commit is contained in:
Lucas Oskorep
2026-03-02 11:26:28 -05:00
parent 400ce3a77c
commit 42c1e6731e
3 changed files with 25 additions and 0 deletions

View File

@@ -161,6 +161,21 @@ export default class WindowContainer {
return this._activeTabIndex; return this._activeTabIndex;
} }
/**
* If the given window is a tab in this container, make it the active tab.
* Returns true if the window was found and activated.
*/
focusWindowTab(windowId: number): boolean {
if (!this.isTabbed()) return false;
const index = this._getIndexOfWindow(windowId);
if (index !== -1 && index !== this._activeTabIndex) {
this.setActiveTab(index);
return true;
}
return index !== -1;
}
hideTabBar(): void { hideTabBar(): void {
this._tabBar?.hide(); this._tabBar?.hide();
} }

View File

@@ -72,6 +72,12 @@ export default class Monitor {
this._workspaces.push(new WindowContainer(this._workArea)); this._workspaces.push(new WindowContainer(this._workArea));
} }
focusWindowTab(windowId: number): void {
for (const container of this._workspaces) {
if (container.focusWindowTab(windowId)) return;
}
}
refreshTabTitlesForWindow(winWrap: WindowWrapper): void { refreshTabTitlesForWindow(winWrap: WindowWrapper): void {
const wsId = winWrap.getWorkspace(); const wsId = winWrap.getWorkspace();
if (wsId >= 0 && wsId < this._workspaces.length) { if (wsId >= 0 && wsId < this._workspaces.length) {

View File

@@ -504,6 +504,10 @@ export default class WindowManager implements IWindowManager {
if (focusWindow) { if (focusWindow) {
this._activeWindowId = focusWindow.get_id(); this._activeWindowId = focusWindow.get_id();
Logger.debug(`Active window changed to: ${this._activeWindowId} (${focusWindow.get_title()})`); Logger.debug(`Active window changed to: ${this._activeWindowId} (${focusWindow.get_title()})`);
// If the focused window is inside a tabbed container, make it the active tab
const monId = focusWindow.get_monitor();
this._monitors.get(monId)?.focusWindowTab(this._activeWindowId);
} else { } else {
this._activeWindowId = null; this._activeWindowId = null;
Logger.debug('No active window'); Logger.debug('No active window');