Skip to content

Commit 0675361

Browse files
committed
fix(tiling): Windows launching onto window that isn't focused
1 parent 12bbefe commit 0675361

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/auto_tiler.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export class AutoTiler {
202202
log.debug(`attach to workspace: ${result.value}`)
203203
this.attach_to_workspace(ext, win, ext.workspace_id(win));
204204
} else {
205+
log.debug(`attaching to window ${win.entity}`)
205206
this.attach_to_window(ext, result.value, win, { auto: 0 })
206207
}
207208
}
@@ -656,7 +657,7 @@ export class AutoTiler {
656657
return Err('ignoring focus');
657658
}
658659

659-
const prev = ext.prev_focused[1]
660+
const prev = ext.prev_focused[0]
660661

661662
if (!prev) {
662663
return Err('no window has been previously focused');

src/extension.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,11 @@ export class Ext extends Ecs.System<ExtEvent> {
792792
this.exception_add(win)
793793
}
794794

795-
this.prev_focused[0] = this.prev_focused[1];
796-
this.prev_focused[1] = win.entity;
795+
// Track history of focused windows, but do not permit duplicates.
796+
if (this.prev_focused[1] !== win.entity) {
797+
this.prev_focused[0] = this.prev_focused[1];
798+
this.prev_focused[1] = win.entity;
799+
}
797800

798801
// Update the active tab in the stack.
799802
if (null !== this.auto_tiler && null !== win.stack) {

0 commit comments

Comments
 (0)