Skip to content

Commit

Permalink
Merge pull request #4 from matthijskooijman/fix-dialogs
Browse files Browse the repository at this point in the history
Only maximize windows that support it
  • Loading branch information
aXe1 authored Sep 13, 2019
2 parents 6644365 + 7a7340f commit 56af23c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
17 changes: 14 additions & 3 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ const Meta = imports.gi.Meta;
let _windowCreatedId;

function enable() {
_windowCreatedId = global.display.connect('window-created', (d, win) =>
win.maximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL)
);
_windowCreatedId = global.display.connect('window-created', (d, win) => {
// Only try to maximize windows that are marked to support this.
// Other windows (e.g. dialogs) can often actually be maximized,
// but then no longer unmaximized by the user, so we really need
// to check this.
if (win.can_maximize()) {
win.maximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL)
} else {
// Workaround for dialogs that were previously maximized by
// us (when we did not check for can_maximize yet) and
// remember their size.
win.unmaximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL)
}
});
}

function disable() {
Expand Down
3 changes: 2 additions & 1 deletion src/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "Maximized by default",
"version": "1.0.0",
"version": "1.1.0",
"description": "Make all windows maximized on start.",
"url": "https://github.com/aXe1/gnome-shell-extension-maximized-by-default",
"uuid": "[email protected]",
"shell-version": [
"3.32",
"3.20.4"
]
}

0 comments on commit 56af23c

Please sign in to comment.