Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo fix(tiling) #1171 #1198

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/auto_tiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ export class AutoTiler {
log.debug(`attach to workspace: ${result.value}`)
this.attach_to_workspace(ext, win, ext.workspace_id(win));
} else {
log.debug(`attaching to window ${win.entity}`)
this.attach_to_window(ext, result.value, win, { auto: 0 })
}
}
Expand Down Expand Up @@ -657,7 +656,7 @@ export class AutoTiler {
return Err('ignoring focus');
}

const prev = ext.previously_focused(win)
const prev = ext.prev_focused[1]

if (!prev) {
return Err('no window has been previously focused');
Expand Down Expand Up @@ -685,9 +684,9 @@ export class AutoTiler {
return Err('focused window is not attached');
}

return onto.workspace_id() == win.workspace_id()
return onto.meta.get_monitor() == win.meta.get_monitor() && onto.workspace_id() == win.workspace_id()
? Ok(onto)
: Err('window is not on the same workspace');
: Err('window is not on the same monitor or workspace');
}

private toggle_orientation_(ext: Ext, focused: ShellWindow): Result<void, string> {
Expand Down
22 changes: 4 additions & 18 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class Ext extends Ecs.System<ExtEvent> {
injections: Array<Injection> = new Array();

/** The window that was focused before the last window */
private prev_focused: [null | Entity, null | Entity] = [null, null];
prev_focused: [null | Entity, null | Entity] = [null, null];

tween_signals: Map<string, [SignalID, any]> = new Map();

Expand Down Expand Up @@ -788,11 +788,8 @@ export class Ext extends Ecs.System<ExtEvent> {
this.exception_add(win)
}

// Track history of focused windows, but do not permit duplicates.
if (this.prev_focused[1] !== win.entity) {
this.prev_focused[0] = this.prev_focused[1];
this.prev_focused[1] = win.entity;
}
this.prev_focused[0] = this.prev_focused[1];
this.prev_focused[1] = win.entity;

// Update the active tab in the stack.
if (null !== this.auto_tiler && null !== win.stack) {
Expand Down Expand Up @@ -1066,17 +1063,6 @@ export class Ext extends Ecs.System<ExtEvent> {
}
}

previously_focused(active: Window.ShellWindow): null | Ecs.Entity {
for (const id of [1, 0]) {
const prev = this.prev_focused[id]
if (prev && ! Ecs.entity_eq(active.entity, prev)) {
return prev;
}
}

return null
}

movement_is_valid(win: Window.ShellWindow, movement: movement.Movement) {
if ((movement & Movement.SHRINK) !== 0) {
if ((movement & Movement.DOWN) !== 0) {
Expand Down Expand Up @@ -2048,7 +2034,7 @@ export class Ext extends Ecs.System<ExtEvent> {
let actor = window.meta.get_compositor_private();
if (actor) {
if (!window.meta.minimized) {
tiler.auto_tile(this, window, true);
tiler.auto_tile(this, window, false);
}
}
}
Expand Down