fix: when new items enter the tabbed view they should be the active window
This commit is contained in:
@@ -161,6 +161,21 @@ export default class WindowContainer {
|
||||
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 {
|
||||
this._tabBar?.hide();
|
||||
}
|
||||
|
||||
@@ -72,6 +72,12 @@ export default class Monitor {
|
||||
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 {
|
||||
const wsId = winWrap.getWorkspace();
|
||||
if (wsId >= 0 && wsId < this._workspaces.length) {
|
||||
|
||||
@@ -504,6 +504,10 @@ export default class WindowManager implements IWindowManager {
|
||||
if (focusWindow) {
|
||||
this._activeWindowId = focusWindow.get_id();
|
||||
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 {
|
||||
this._activeWindowId = null;
|
||||
Logger.debug('No active window');
|
||||
|
||||
Reference in New Issue
Block a user