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: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/338>
This commit is contained in:
Florian Müllner
2024-10-16 12:19:52 +00:00
committed by Marge Bot
parent 3c325c1562
commit 763d66b827
2 changed files with 28 additions and 0 deletions
+22
View File
@@ -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);
}
}
@@ -81,3 +81,9 @@
width: 24px;
height: 24px;
}
.window-button-abstract-label {
background-color: #888;
border-radius: 99px;
margin: 6px;
}