From 93a75dccd779737a39530dd9e806dfe886a3daf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 25 Sep 2024 03:20:52 +0200 Subject: [PATCH] window-list: Split out `_createTitleActor()` hook This will allow creating a suitable drag actor that matches the current title. In particular this allows for a drag actor that isn't based on `ClutterClone`, and therefore doesn't inherit focus/active/minimize/etc. styles that don't make sense outside the actual window list. Part-of: --- extensions/window-list/extension.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 3ed1c357..21823cf8 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -357,6 +357,11 @@ class BaseButton extends DashItemContainer { this._onClicked(this, 1); } + _createTitleActor() { + throw new GObject.NotImplementedError( + `_createTitleActor in ${this.constructor.name}`); + } + _onClicked(_actor, _button) { throw new GObject.NotImplementedError( `_onClicked in ${this.constructor.name}`); @@ -467,7 +472,7 @@ class WindowButton extends BaseButton { this._updateVisibility(); - this._windowTitle = new WindowTitle(this.metaWindow); + this._windowTitle = this._createTitleActor(); this._button.set_child(this._windowTitle); this.label_actor = this._windowTitle.label_actor; @@ -483,6 +488,10 @@ class WindowButton extends BaseButton { this._updateStyle(); } + _createTitleActor() { + return new WindowTitle(this.metaWindow); + } + _onClicked(actor, button) { if (this._contextMenu.isOpen) { this._contextMenu.close(); @@ -667,13 +676,12 @@ class AppButton extends BaseButton { if (this._singleWindowMode) { const [window] = windows; - this._button.child = new WindowTitle(window); this._contextMenu = new WindowContextMenu(this, window); } else { - this._button.child = new AppTitle(this.app); this._contextMenu = new AppContextMenu(this); } + this._button.child = this._createTitleActor(); this.label_actor = this._button.child.label_actor; this._contextMenu.connect( @@ -683,6 +691,15 @@ class AppButton extends BaseButton { this._contextMenuManager.addMenu(this._contextMenu); } + _createTitleActor() { + if (this._singleWindowMode) { + const [window] = this.getWindowList(); + return new WindowTitle(window); + } else { + return new AppTitle(this.app); + } + } + _onClicked(actor, button) { let menuWasOpen = this._menu.isOpen; if (menuWasOpen)