Skip to content

Commit eefa856

Browse files
jmmarananmmstick
authored andcommitted
fix: update border align on snap edge
1 parent bb40c9a commit eefa856

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/window.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export class ShellWindow {
242242
return maximized;
243243
}
244244

245+
245246
/**
246247
* Window is maximized, 0 gapped or smart gapped
247248
*/
@@ -251,6 +252,15 @@ export class ShellWindow {
251252
return this.is_maximized() || this.ext.settings.gap_inner() === 0 || this.smart_gapped;
252253
}
253254

255+
is_single_max_screen(): boolean {
256+
let monitor_count = this.meta.get_display().get_n_monitors();
257+
return this.is_max_screen() && monitor_count == 1;
258+
}
259+
260+
is_snap_edge(): boolean {
261+
return this.meta.get_maximized() == Meta.MaximizeFlags.VERTICAL;
262+
}
263+
254264
is_tilable(ext: Ext): boolean {
255265
let tile_checks = () => {
256266
let wm_class = this.meta.get_wm_class();
@@ -400,9 +410,8 @@ export class ShellWindow {
400410
this.restack();
401411
if (this.ext.settings.active_hint()) {
402412
let border = this.border;
403-
let monitor_count = this.meta.get_display().get_n_monitors();
404413
if (!this.meta.is_fullscreen() &&
405-
!(this.is_max_screen() && monitor_count == 1) &&
414+
(!this.is_single_max_screen() || this.is_snap_edge()) &&
406415
!this.meta.minimized &&
407416
this.same_workspace()) {
408417
if (this.meta.appears_focused) {
@@ -427,9 +436,8 @@ export class ShellWindow {
427436
*/
428437
restack(updateState: RESTACK_STATE = RESTACK_STATE.NORMAL) {
429438
this.update_border_layout();
430-
let monitor_count = this.meta.get_display().get_n_monitors();
431439
if (this.meta.is_fullscreen() ||
432-
(this.is_max_screen() && monitor_count == 1) ||
440+
(this.is_single_max_screen() && !this.is_snap_edge()) ||
433441
this.meta.minimized) {
434442
this.hide_border()
435443
}
@@ -517,7 +525,7 @@ export class ShellWindow {
517525
let borderSize = this.border_size;
518526

519527
if (border) {
520-
if (!this.is_max_screen()) {
528+
if (!(this.is_max_screen() || this.is_snap_edge())) {
521529
border.remove_style_class_name('pop-shell-border-maximize');
522530
} else {
523531
borderSize = 0;
@@ -559,12 +567,12 @@ export class ShellWindow {
559567

560568
if (workspace === null) return;
561569

562-
/*const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor())
570+
const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor())
563571

564572
if (screen) {
565573
width = Math.min(width, screen.x + screen.width)
566574
height = Math.min(height, screen.y + screen.height)
567-
}*/
575+
}
568576

569577
border.set_position(x, y)
570578
border.set_size(width, height)

0 commit comments

Comments
 (0)