diff --git a/src/mod.d.ts b/src/mod.d.ts index 270aa5ec..5e44a5ab 100644 --- a/src/mod.d.ts +++ b/src/mod.d.ts @@ -153,9 +153,9 @@ declare namespace Meta { } enum MaximizeFlags { - HORIZONTAL, - VERTICAL, - BOTH + HORIZONTAL = 1, + VERTICAL = 2, + BOTH = 3 } enum MotionDirection { @@ -187,6 +187,7 @@ declare namespace Meta { delete(timestamp: number): void; get_buffer_rect(): Rectangular; get_compositor_private(): Clutter.Actor | null; + get_display(): Meta.Display | null; get_description(): string; get_frame_rect(): Rectangular; get_maximized(): number; diff --git a/src/window.ts b/src/window.ts index f593cd2c..aa6703a9 100644 --- a/src/window.ts +++ b/src/window.ts @@ -238,9 +238,11 @@ export class ShellWindow { } is_maximized(): boolean { - return this.meta.get_maximized() !== 0; + let maximized = this.meta.get_maximized() !== 0; + return maximized; } + /** * Window is maximized, 0 gapped or smart gapped */ @@ -250,6 +252,15 @@ export class ShellWindow { return this.is_maximized() || this.ext.settings.gap_inner() === 0 || this.smart_gapped; } + is_single_max_screen(): boolean { + let monitor_count = this.meta.get_display().get_n_monitors(); + return (this.is_maximized() || this.smart_gapped) && monitor_count == 1; + } + + is_snap_edge(): boolean { + return this.meta.get_maximized() == Meta.MaximizeFlags.VERTICAL; + } + is_tilable(ext: Ext): boolean { let tile_checks = () => { let wm_class = this.meta.get_wm_class(); @@ -400,6 +411,7 @@ export class ShellWindow { if (this.ext.settings.active_hint()) { let border = this.border; if (!this.meta.is_fullscreen() && + (!this.is_single_max_screen() || this.is_snap_edge()) && !this.meta.minimized && this.same_workspace()) { if (this.meta.appears_focused) { @@ -424,8 +436,9 @@ export class ShellWindow { */ restack(updateState: RESTACK_STATE = RESTACK_STATE.NORMAL) { this.update_border_layout(); - - if (this.meta.is_fullscreen()) { + if (this.meta.is_fullscreen() || + (this.is_single_max_screen() && !this.is_snap_edge()) || + this.meta.minimized) { this.hide_border() } @@ -512,7 +525,7 @@ export class ShellWindow { let borderSize = this.border_size; if (border) { - if (!this.is_max_screen()) { + if (!(this.is_max_screen() || this.is_snap_edge())) { border.remove_style_class_name('pop-shell-border-maximize'); } else { borderSize = 0; @@ -527,7 +540,7 @@ export class ShellWindow { if (stack) { let stack_tab_height = stack.tabs_height; - if (borderSize === 0 || this.grab === null) { // not in max screen state + if (borderSize === 0 || this.grab) { // not in max screen state stack_tab_height = 0; } @@ -557,8 +570,6 @@ export class ShellWindow { const screen = workspace.get_work_area_for_monitor(this.meta.get_monitor()) if (screen) { - x = Math.max(x, screen.x) - y = Math.max(y, screen.y) width = Math.min(width, screen.x + screen.width) height = Math.min(height, screen.y + screen.height) } @@ -641,4 +652,4 @@ function pointer_already_on_window(meta: Meta.Window): boolean { const cursor = lib.cursor_rect() return cursor.intersects(meta.get_frame_rect()) -} \ No newline at end of file +}