1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
From 4a324548dcd14a3394baeec55b3ac36de4f21802 Mon Sep 17 00:00:00 2001
From: Rahul Sahoo <rahulsahoo66@gmail.com>
Date: Wed, 24 Sep 2025 14:45:40 +0530
Subject: [PATCH 1/2] fix: update window maximization logic to use new
properties and added gnome 49 shell version in metadata
---
metadata.json | 3 ++-
src/auto_tiler.ts | 2 +-
src/mod.d.ts | 3 ++-
src/window.ts | 10 +++++-----
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/metadata.json b/metadata.json
index 705da42e..41e860ff 100644
--- a/metadata.json
+++ b/metadata.json
@@ -8,6 +8,7 @@
"45",
"46",
"47",
- "48"
+ "48",
+ "49"
]
}
diff --git a/src/auto_tiler.ts b/src/auto_tiler.ts
index ccaafffe..2a5cc51f 100644
--- a/src/auto_tiler.ts
+++ b/src/auto_tiler.ts
@@ -700,7 +700,7 @@ export class AutoTiler {
}
private toggle_orientation_(ext: Ext, focused: ShellWindow): Result<void, string> {
- if (focused.meta.get_maximized()) {
+ if (focused.is_maximized()) {
return Err('cannot toggle maximized window');
}
diff --git a/src/mod.d.ts b/src/mod.d.ts
index bb840e58..e1ac012f 100644
--- a/src/mod.d.ts
+++ b/src/mod.d.ts
@@ -275,6 +275,8 @@ declare namespace Meta {
minimized: Readonly<boolean>;
window_type: Readonly<any>;
decorated: Readonly<boolean>;
+ maximized_horizontally: Readonly<boolean>;
+ maximized_vertically: Readonly<boolean>;
activate(time: number): void;
change_workspace_by_index(workspace: number, append: boolean): void;
@@ -284,7 +286,6 @@ declare namespace Meta {
get_display(): Meta.Display | null;
get_description(): string;
get_frame_rect(): Rectangular;
- get_maximized(): number;
get_monitor(): number;
get_pid(): number;
get_role(): null | string;
diff --git a/src/window.ts b/src/window.ts
index 5be8ae5e..2fbd2928 100644
--- a/src/window.ts
+++ b/src/window.ts
@@ -276,7 +276,7 @@ export class ShellWindow {
}
is_maximized(): boolean {
- return this.meta.get_maximized() !== 0;
+ return this.meta.maximized_horizontally || this.meta.maximized_vertically;
}
/**
@@ -300,7 +300,7 @@ export class ShellWindow {
}
is_snap_edge(): boolean {
- return this.meta.get_maximized() == Meta.MaximizeFlags.VERTICAL;
+ return this.meta.maximized_vertically && !this.meta.maximized_horizontally;
}
is_tilable(ext: Ext): boolean {
@@ -372,9 +372,9 @@ export class ShellWindow {
const actor = meta.get_compositor_private();
if (actor) {
- meta.unmaximize(Meta.MaximizeFlags.HORIZONTAL);
- meta.unmaximize(Meta.MaximizeFlags.VERTICAL);
- meta.unmaximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL);
+ if (this.is_maximized()) {
+ meta.unmaximize(Meta.MaximizeFlags.BOTH);
+ }
actor.remove_all_transitions();
ext.movements.insert(this.entity, clone);
From d6bd0f963047bd63493d4efd36da248198570816 Mon Sep 17 00:00:00 2001
From: Rahul Sahoo <rahulsahoo66@gmail.com>
Date: Wed, 24 Sep 2025 18:30:33 +0530
Subject: [PATCH 2/2] fix: using Mtk instead of Meta in extension.ts
---
src/extension.ts | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/extension.ts b/src/extension.ts
index 99f02088..503407f3 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -44,6 +44,13 @@ import Gio from 'gi://Gio';
import St from 'gi://St';
import Shell from 'gi://Shell';
import Meta from 'gi://Meta';
+// Try to import Mtk for newer GNOME versions, fallback to Meta for older versions
+let Mtk: any;
+try {
+ Mtk = imports.gi.Mtk;
+} catch (e) {
+ Mtk = null;
+}
const { GlobalEvent, WindowEvent } = Events;
const { cursor_rect, is_keyboard_op, is_resize_op, is_move_op } = Lib;
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
@@ -480,7 +487,7 @@ export class Ext extends Ecs.System<ExtEvent> {
if (old) {
try {
GLib.source_remove(old);
- } catch (_) {}
+ } catch (_) { }
}
const new_s = GLib.timeout_add(GLib.PRIORITY_LOW, 500, () => {
@@ -1258,7 +1265,7 @@ export class Ext extends Ecs.System<ExtEvent> {
this.register(Events.window_move(this, win, rect));
} else {
- win.move(this, rect, () => {});
+ win.move(this, rect, () => { });
// if the resulting dimensions of rect == next
if (rect.width == next_area.width && rect.height == next_area.height) {
win.meta.maximize(Meta.MaximizeFlags.BOTH);
@@ -1481,7 +1488,7 @@ export class Ext extends Ecs.System<ExtEvent> {
[area, monitor_attachment] =
(win.stack === null && attach_to.stack === null && is_sibling) ||
- (win.stack === null && is_sibling)
+ (win.stack === null && is_sibling)
? [fork.area, false]
: [attach_to.meta.get_frame_rect(), false];
} else {
@@ -1512,8 +1519,8 @@ export class Ext extends Ecs.System<ExtEvent> {
? [area.x, area.y, half_width, area.height]
: [area.x + half_width, area.y, half_width, area.height]
: swap
- ? [area.x, area.y, area.width, half_height]
- : [area.x, area.y + half_height, area.width, half_height];
+ ? [area.x, area.y, area.width, half_height]
+ : [area.x, area.y + half_height, area.width, half_height];
this.overlay.x = new_area[0];
this.overlay.y = new_area[1];
@@ -1542,8 +1549,8 @@ export class Ext extends Ecs.System<ExtEvent> {
this.current_style = this.settings.is_dark()
? Style.Dark
: this.settings.is_high_contrast()
- ? Style.HighContrast
- : Style.Light;
+ ? Style.HighContrast
+ : Style.Light;
}
/** Handle window maximization notifications */
@@ -2292,7 +2299,7 @@ export class Ext extends Ecs.System<ExtEvent> {
this.moved_by_mouse = false;
}
- update_display_configuration_before() {}
+ update_display_configuration_before() { }
update_display_configuration(workareas_only: boolean) {
if (!this.auto_tiler || sessionMode.isLocked) return;
@@ -2623,7 +2630,10 @@ export class Ext extends Ecs.System<ExtEvent> {
cursor_status(): [Rectangle, number] {
const cursor = cursor_rect();
- const rect = new Meta.Rectangle({ x: cursor.x, y: cursor.y, width: 1, height: 1 });
+ // Use Mtk.Rectangle if available (newer GNOME), otherwise fallback to Meta.Rectangle
+ const rect = Mtk ?
+ new Mtk.Rectangle({ x: cursor.x, y: cursor.y, width: 1, height: 1 }) :
+ new Meta.Rectangle({ x: cursor.x, y: cursor.y, width: 1, height: 1 });
const monitor = display.get_monitor_index_for_rect(rect);
return [cursor, monitor];
}
@@ -2665,12 +2675,12 @@ let ext: Ext | null = null;
let indicator: Indicator | null = null;
declare global {
- var popShellExtension: any;
+ var popShellExtension: any;
}
export default class PopShellExtension extends Extension {
enable() {
- globalThis.popShellExtension = this;
+ globalThis.popShellExtension = this;
log.info('enable');
if (!ext) {
|