Skip to content

Commit 83cf486

Browse files
Fix: Maximized windows losing maximization
1 parent 44ca2cd commit 83cf486

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ debian/*
1111
!debian/rules
1212
!debian/*install
1313
.confirm_shortcut_change
14-
.vscode
14+
.vscode
15+
node_modules

src/extension.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ export class Ext extends Ecs.System<ExtEvent> {
244244
this.dbus.Launcher = () => this.window_search.open(this)
245245

246246
this.dbus.WindowFocus = (window: [number, number]) => {
247-
this.windows.get(window)?.activate()
247+
const target_window = this.windows.get(window)
248+
if (target_window) {
249+
target_window.activate()
250+
this.on_focused(target_window)
251+
}
248252
this.window_search.close()
249253
}
250254

@@ -628,28 +632,24 @@ export class Ext extends Ecs.System<ExtEvent> {
628632
}
629633

630634
focus_left() {
631-
this.unmaximize_workspace(null)
632635
this.stack_select(
633636
(id, stack) => id === 0 ? null : stack.tabs[id - 1].entity,
634637
() => this.activate_window(this.focus_selector.left(this, null))
635638
);
636639
}
637640

638641
focus_right() {
639-
this.unmaximize_workspace(null)
640642
this.stack_select(
641643
(id, stack) => stack.tabs.length > id + 1 ? stack.tabs[id + 1].entity : null,
642644
() => this.activate_window(this.focus_selector.right(this, null))
643645
)
644646
}
645647

646648
focus_down() {
647-
this.unmaximize_workspace(null)
648649
this.activate_window(this.focus_selector.down(this, null))
649650
}
650651

651652
focus_up() {
652-
this.unmaximize_workspace(null)
653653
this.activate_window(this.focus_selector.up(this, null))
654654
}
655655

@@ -890,7 +890,7 @@ export class Ext extends Ecs.System<ExtEvent> {
890890
let prev = this.windows.get(this.prev_focused[0]);
891891
let is_attached = this.auto_tiler.attached.contains(this.prev_focused[0]);
892892

893-
if (prev && prev !== win && is_attached && prev.actor_exists() && prev.name(this) !== win.name(this)) {
893+
if (prev && prev !== win && is_attached && prev.actor_exists() && prev.name(this) !== win.name(this) && prev.workspace_id() === win.workspace_id()) {
894894
if (prev.rect().contains(win.rect())) {
895895
if (prev.is_maximized()) {
896896
prev.meta.unmaximize(Meta.MaximizeFlags.BOTH);
@@ -995,25 +995,24 @@ export class Ext extends Ecs.System<ExtEvent> {
995995
}
996996

997997
/** Unmaximize any maximized windows on the same workspace. */
998-
unmaximize_workspace(win: Window.ShellWindow | null) {
998+
unmaximize_workspace(win: Window.ShellWindow) {
999999
if (this.auto_tiler) {
10001000
let mon
10011001
let work
10021002

1003-
if (win == null) {
1004-
[mon, work] = this.workspace_id()
1005-
} else {
1006-
mon = win.meta.get_monitor()
1007-
work = win.meta.get_workspace().index()
1003+
if (!win.is_tilable(this)) {
1004+
return
10081005
}
1006+
1007+
mon = win.meta.get_monitor()
1008+
work = win.meta.get_workspace().index()
10091009

10101010
for (const [, compare] of this.windows.iter()) {
10111011
const is_same_space = compare.meta.get_monitor() === mon
1012-
&& compare.meta.get_workspace().index() === work;
1013-
if (is_same_space && !this.contains_tag(compare.entity, Tags.Floating)) {
1014-
if (compare.is_maximized()) {
1012+
&& compare.meta.get_workspace().index() === work ;
1013+
1014+
if (is_same_space && !this.contains_tag(compare.entity, Tags.Floating) && compare.is_maximized() && win.entity[0] !== compare.entity[0]) {
10151015
compare.meta.unmaximize(Meta.MaximizeFlags.BOTH);
1016-
}
10171016
}
10181017
}
10191018
}

0 commit comments

Comments
 (0)