workspace-indicator: Allow overriding base style class

This will allow reusing the code from the window-list extension
without limiting the ability to specify styling that only applies
to one of the extensions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/307>
This commit is contained in:
Florian Müllner
2024-02-23 01:59:15 +01:00
committed by Marge Bot
parent d3debab713
commit e96015b9ea

View File

@@ -25,6 +25,8 @@ const TOOLTIP_ANIMATION_TIME = 150;
const MAX_THUMBNAILS = 6;
let baseStyleClassName = '';
class WindowPreview extends St.Button {
static {
GObject.registerClass(this);
@@ -32,7 +34,7 @@ class WindowPreview extends St.Button {
constructor(window) {
super({
style_class: 'workspace-indicator-window-preview',
style_class: `${baseStyleClassName}-window-preview`,
});
this._delegate = this;
@@ -256,10 +258,15 @@ export class WorkspaceIndicator extends PanelMenu.Button {
GObject.registerClass(this);
}
constructor() {
constructor(params = {}) {
super(0.5, _('Workspace Indicator'));
this.add_style_class_name('workspace-indicator');
const {
baseStyleClass = 'workspace-indicator',
} = params;
baseStyleClassName = baseStyleClass;
this.add_style_class_name(baseStyleClassName);
let container = new St.Widget({
layout_manager: new Clutter.BinLayout(),