Skip to content

St.BoxLayout.vertical is deprecated on Gnome 48 [with possible fix] #312

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
damian-aragunde-udc opened this issue Apr 7, 2025 · 1 comment
Labels
question Further information is requested

Comments

@damian-aragunde-udc
Copy link

damian-aragunde-udc commented Apr 7, 2025

Description:
As I boot up the system and look at the journals, I notice this report:

abr 05 16:51:03 mysetup-lin gnome-shell[1135]: The GObject property St.BoxLayout.vertical is deprecated.
                                               0 setWidgetOrientation() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":184:5]
                                               1 DefaultMenu() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":5747:25]
                                               2 enable() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":6324:25]
                                               3 createIndicator() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":7492:21]
                                               4 enable() ["file:///home/me/.local/share/gnome-shell/extensions/[email protected]/extension.js":7544:10]
                                               5 _callExtensionEnable() ["resource:///org/gnome/shell/ui/extensionSystem.js":266:38]
                                               6 loadExtension() ["resource:///org/gnome/shell/ui/extensionSystem.js":433:32]
                                               7 InterpretGeneratorResume() ["self-hosted":1417:34]
                                               8 AsyncFunctionNext() ["self-hosted":804:27]
                                               9 anonymous() ["resource:///org/gnome/shell/ui/init.js":21:20]

The search:
So when I looked at the code, I found this:

// Compatibility for GNOME 48+ where 'vertical' was deprecated in favor of 'orientation'
export function setWidgetOrientation(
    widget: { vertical?: boolean; orientation?: Clutter.Orientation },
    vertical: boolean,
) {
    if (widget.orientation) {
        widget.orientation = vertical
            ? Clutter.Orientation.VERTICAL
            : Clutter.Orientation.HORIZONTAL;
    } else {
        widget.vertical = vertical;
    }
}

At src/utils/ui.ts

The possible problem:
It seems that with Gnome 48 it always results in the "else" clause being executed.
So with this condition, the value could be 'negative' until 'orientation' is existing.

My fix:
I used the "in" operation instead:

function setWidgetOrientation(widget, vertical) {
//  if (widget.orientation) {
//    widget.orientation = vertical ? Clutter.Orientation.VERTICAL : Clutter.Orientation.HORIZONTAL;
//  } else {
//    widget.vertical = vertical;
//  }
    if ('orientation' in widget) {
        widget.orientation = vertical
            ? Clutter.Orientation.VERTICAL
            : Clutter.Orientation.HORIZONTAL;
    } else {
        widget.vertical = vertical;
    }
}

Also, from my quick look on the web, the deprecation starts at Gnome 46, not 48. Perhaps this could be corrected in the comments. ;)

Information:

  • Tiling Shell version: 16.3
  • GNOME version: 48.0
  • Distro: Manjaro Linux
@domferr
Copy link
Owner

domferr commented Apr 12, 2025

Hey thank you for sharing this! The official guide to port extensions to GNOME 48 says that the actual removal of the orientation will start in future GNOME versions, but with 48 the orientation will still exist! Do you know if it is better to already switch to the orientation?

@domferr domferr added the question Further information is requested label Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants