From 763d66b82711d1bbc56377bc393edbd7fab91f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Oct 2024 17:27:57 +0200 Subject: [PATCH] window-list: Add TitleWidget:abstract-label property When true, the real label is replaced by a more abstract representation. When used as drag actor, the focus is not on identifying the window/app, but about picking a drop location, and the reduced style helps with that. Part-of: --- extensions/window-list/extension.js | 22 ++++++++++++++++++++++ extensions/window-list/stylesheet-dark.css | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 383d0b72..3ed1c357 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -109,6 +109,12 @@ class TitleWidget extends St.BoxLayout { static { GObject.registerClass({ GTypeFlags: GObject.TypeFlags.ABSTRACT, + Properties: { + 'abstract-label': GObject.ParamSpec.boolean( + 'abstract-label', null, null, + GObject.ParamFlags.READWRITE, + false), + }, }, this); } @@ -129,6 +135,22 @@ class TitleWidget extends St.BoxLayout { }); this.add_child(this._label); this.label_actor = this._label; + + this.bind_property('abstract-label', + this._label, 'visible', + GObject.BindingFlags.SYNC_CREATE | + GObject.BindingFlags.INVERT_BOOLEAN); + + this._abstractLabel = new St.Widget({ + style_class: 'window-button-abstract-label', + x_expand: true, + y_expand: true, + }); + this.add_child(this._abstractLabel); + + this.bind_property('abstract-label', + this._abstractLabel, 'visible', + GObject.BindingFlags.SYNC_CREATE); } } diff --git a/extensions/window-list/stylesheet-dark.css b/extensions/window-list/stylesheet-dark.css index f02fca60..fce6bcc5 100644 --- a/extensions/window-list/stylesheet-dark.css +++ b/extensions/window-list/stylesheet-dark.css @@ -81,3 +81,9 @@ width: 24px; height: 24px; } + +.window-button-abstract-label { + background-color: #888; + border-radius: 99px; + margin: 6px; +}