Skip to content

tilingWindowManager: Semi-maximize windows when possible #239

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ var Handler = class TilingMoveHandler {
// Also work with a window, which was maximized by GNOME natively
// because it may have been tiled with this extension before being
// maximized so we need to restore its size to pre-tiling.
this._wasMaximizedOnStart = window.get_maximized();
this._wasMaximizedOnStart = window.get_maximized() === Meta.MaximizeFlags.BOTH;
const [x, y] = global.get_pointer();

// Try to restore the window size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ var TilingWindowManager = class TilingWindowManager {
const monitor = monitorNr ?? window.get_monitor();
const workArea = new Rect(window.get_work_area_for_monitor(monitor));
const maximize = newRect.equal(workArea);
const verticalMaximize = !maximize && newRect.height === workArea.height;
const horizontalMaximize = !maximize && newRect.width === workArea.width;

window.isTiled = !maximize;
if (!window.untiledRect)
Expand Down Expand Up @@ -194,6 +196,11 @@ var TilingWindowManager = class TilingWindowManager {
);
}

if (verticalMaximize)
window.maximize(Meta.MaximizeFlags.VERTICAL);
else if (horizontalMaximize)
window.maximize(Meta.MaximizeFlags.HORIZONTAL);

// See issue #137.
// Under some circumstances it's possible that windows will tile to the wrong
// monitor. I can't reproduce it but I suspect that it's because of passing
Expand Down