Skip to content

Conversation

@mendres82
Copy link
Contributor

Updated to reflect GNOME 49 API changes:

Meta.Window
Meta.Window removes the Meta.MaximizeFlags from the parameters for maximize() and unmaximize(). Also get_maximized() is removed and you can use is_maximized() instead. To maximize or unmaximize the window horizontally or vertically, you can call new methods set_maximize_flags() and set_unmaximize_flags().

@gadicc
Copy link

gadicc commented Oct 10, 2025

I wonder if we could still support older versions with something like:

-            const currentMetaMaximized = metaWindow.get_maximized();
+            const currentMetaMaximized = (metaWindow.get_maximized || metaWindow.is_maximized)();

@mendres82
Copy link
Contributor Author

mendres82 commented Oct 10, 2025

If we had to maintain compatibility to older GNOME versions, I'd probably write separate blocks, because

  1. it handles both changed methods metaWindow.is_maximized() and metaWindow.maximize() correctly and
  2. makes the code easy to maintain, once you decide to remove the support for a specific version.
  3. The code is clear in what it's doing.
const Config = imports.misc.config;
const shellVersion = parseFloat(Config.PACKAGE_VERSION);

if (shellVersion < 49) {
    const currentMetaMaximized = metaWindow.get_maximized();
    if (currentMetaMaximized !== Meta.MaximizeFlags.BOTH) {
        this._log.debug(`Maximizing ${metaWindow.get_title()}`);
        metaWindow.maximize(savedMetaMaximized);
    }
} else {
    const currentMetaMaximized = metaWindow.is_maximized();
    if (currentMetaMaximized !== Meta.MaximizeFlags.BOTH) {
        this._log.debug(`Maximizing ${metaWindow.get_title()}`);
        metaWindow.maximize();
    }                
}

Please note: I didn't test any of this yet, it's just a suggestion.

@gadicc
Copy link

gadicc commented Oct 10, 2025

Yeah good point. What's your preference, @nlpsuge? Should we drop old versions or still support them for a while?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants