From 094ffeea309f4a3e2578ca9d193995b45a06a84f Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sat, 1 Feb 2025 17:32:09 -0500 Subject: [PATCH] Add gnome-shell 48 support --- metadata.json | 2 +- src/appIcons.js | 2 +- src/panel.js | 6 +++--- src/panelManager.js | 2 +- src/taskbar.js | 2 +- src/utils.js | 11 +++++++++++ src/windowPreview.js | 2 +- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/metadata.json b/metadata.json index e2c7056..f2ce574 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "uuid": "dash-to-panel@jderose9.github.com", "name": "Dash to Panel", "description": "An icon taskbar for the Gnome Shell. This extension moves the dash into the gnome main panel so that the application launchers and system tray are combined into a single panel, similar to that found in KDE Plasma and Windows 7+. A separate dock is no longer needed for easy access to running and favorited applications.\n\nFor a more traditional experience, you may also want to use Tweak Tool to enable Windows > Titlebar Buttons > Minimize & Maximize.\n\nFor the best support, please report any issues on Github. Dash-to-panel is developed and maintained by @jderose9 and @charlesg99.", - "shell-version": [ "46", "47" ], + "shell-version": [ "46", "47", "48" ], "url": "https://github.com/home-sweet-gnome/dash-to-panel", "gettext-domain": "dash-to-panel", "version": 9999, diff --git a/src/appIcons.js b/src/appIcons.js index 24c20e5..67141db 100644 --- a/src/appIcons.js +++ b/src/appIcons.js @@ -180,7 +180,7 @@ export const TaskbarAppIcon = GObject.registerClass( this._dtpIconContainer.add_child(this._iconContainer) if (appInfo.window) { - let box = new St.BoxLayout() + let box = Utils.createBoxLayout() this._windowTitle = new St.Label({ y_align: Clutter.ActorAlign.CENTER, diff --git a/src/panel.js b/src/panel.js index 6e7507a..a0558b0 100644 --- a/src/panel.js +++ b/src/panel.js @@ -121,13 +121,13 @@ export const Panel = GObject.registerClass( Main.panel._onMenuSet.call(this, indicator) } - this._leftBox = this.panel._leftBox = new St.BoxLayout({ + this._leftBox = this.panel._leftBox = Utils.createBoxLayout({ name: 'panelLeft', }) - this._centerBox = this.panel._centerBox = new St.BoxLayout({ + this._centerBox = this.panel._centerBox = Utils.createBoxLayout({ name: 'panelCenter', }) - this._rightBox = this.panel._rightBox = new St.BoxLayout({ + this._rightBox = this.panel._rightBox = Utils.createBoxLayout({ name: 'panelRight', }) diff --git a/src/panelManager.js b/src/panelManager.js index 9fa5388..cce0e92 100755 --- a/src/panelManager.js +++ b/src/panelManager.js @@ -530,7 +530,7 @@ export const PanelManager = class { let clipContainer = new Clutter.Actor() if (isStandalone) { - panelBox = new St.BoxLayout({ name: 'panelBox' }) + panelBox = new Utils.createBoxLayout({ name: 'panelBox' }) } else { panelBox = Main.layoutManager.panelBox Main.layoutManager._untrackActor(panelBox) diff --git a/src/taskbar.js b/src/taskbar.js index b4d0ea3..8107945 100644 --- a/src/taskbar.js +++ b/src/taskbar.js @@ -309,7 +309,7 @@ export const Taskbar = class extends EventEmitter { let isVertical = panel.checkIfVertical() - this._box = new St.BoxLayout({ + this._box = Utils.createBoxLayout({ vertical: isVertical, clip_to_allocation: false, x_align: Clutter.ActorAlign.START, diff --git a/src/utils.js b/src/utils.js index f100a2c..53e4c76 100644 --- a/src/utils.js +++ b/src/utils.js @@ -30,6 +30,7 @@ import Graphene from 'gi://Graphene' import Meta from 'gi://Meta' import Shell from 'gi://Shell' import St from 'gi://St' +import * as Config from 'resource:///org/gnome/shell/misc/config.js' import * as Util from 'resource:///org/gnome/shell/misc/util.js' import * as Main from 'resource:///org/gnome/shell/ui/main.js' import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js' @@ -180,6 +181,16 @@ export const TimeoutsHandler = class extends BasicHandler { } } +export function createBoxLayout(options) { + if (options && Config.PACKAGE_VERSION >= '48') { + // https://mutter.gnome.org/clutter/enum.Orientation.html + options.orientation = options.vertical ? 1 : 0 + delete options.vertical + } + + return new St.BoxLayout(options) +} + // This is wrapper to maintain compatibility with GNOME-Shell 3.30+ as well as // previous versions. export const DisplayWrapper = { diff --git a/src/windowPreview.js b/src/windowPreview.js index 35bc45d..ed67041 100644 --- a/src/windowPreview.js +++ b/src/windowPreview.js @@ -92,7 +92,7 @@ export const PreviewMenu = GObject.registerClass( y_align: Clutter.ActorAlign[geom.position != St.Side.BOTTOM ? 'START' : 'END'], }) - this._box = new St.BoxLayout({ vertical: this.isVertical }) + this._box = Utils.createBoxLayout({ vertical: this.isVertical }) this._scrollView = new St.ScrollView({ name: 'dashtopanelPreviewScrollview', hscrollbar_policy: St.PolicyType.NEVER,