gnome-shell-extensions/more-ws-previews-0021-workspace-indicator-Handle-active-indication-in-thum.patch
Florian Müllner e6414d8afc
Re-apply downstream patches
Re-apply rebased and updated version of the RHEL 9 downstream
patches, with some exceptions:

Branding is still TBD, so has been left out for now.

The desktop-icons extension will be replaced by an upstreamed
version of desktop-icons-ng, which is still work-in-progress.

Both dash-to-dock and dash-to-panel will be moved to separate
packages, based on the existing Fedora package.

It was decided to drop the panel-favorites and updates-dialog
extensions.

Resolves: RHEL-34255
2024-05-15 02:56:19 +02:00

100 lines
3.3 KiB
Diff

From 13dce7fcc1013a3cbb3a1e521e123a5d4ede75c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Tue, 27 Feb 2024 21:20:45 +0100
Subject: [PATCH 21/28] workspace-indicator: Handle active indication in
thumbnail
Meta.Workspace has had an `active` property for a while now, so
we can use a property binding instead of tracking the active
workspace ourselves.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/316>
---
.../workspace-indicator/workspaceIndicator.js | 35 ++++++++++++-------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/extensions/workspace-indicator/workspaceIndicator.js b/extensions/workspace-indicator/workspaceIndicator.js
index 14dd81d0..bf6511a0 100644
--- a/extensions/workspace-indicator/workspaceIndicator.js
+++ b/extensions/workspace-indicator/workspaceIndicator.js
@@ -111,6 +111,13 @@ class WorkspaceLayout extends Clutter.LayoutManager {
}
class WorkspaceThumbnail extends St.Button {
+ static [GObject.properties] = {
+ 'active': GObject.ParamSpec.boolean(
+ 'active', '', '',
+ GObject.ParamFlags.READWRITE,
+ false),
+ };
+
static {
GObject.registerClass(this);
}
@@ -143,6 +150,10 @@ class WorkspaceThumbnail extends St.Button {
let workspaceManager = global.workspace_manager;
this._workspace = workspaceManager.get_workspace_by_index(index);
+ this._workspace.bind_property('active',
+ this, 'active',
+ GObject.BindingFlags.SYNC_CREATE);
+
this._workspace.connectObject(
'window-added', (ws, window) => this._addWindow(window),
'window-removed', (ws, window) => this._removeWindow(window),
@@ -155,6 +166,18 @@ class WorkspaceThumbnail extends St.Button {
this._onRestacked();
}
+ get active() {
+ return this.has_style_class_name('active');
+ }
+
+ set active(active) {
+ if (active)
+ this.add_style_class_name('active');
+ else
+ this.remove_style_class_name('active');
+ this.notify('active');
+ }
+
acceptDrop(source) {
if (!source.metaWindow)
return false;
@@ -360,7 +383,6 @@ export class WorkspaceIndicator extends PanelMenu.Button {
this._currentWorkspace = global.workspace_manager.get_active_workspace_index();
this._updateMenuOrnament();
- this._updateActiveThumbnail();
this._statusLabel.set_text(this._getStatusText());
}
@@ -379,16 +401,6 @@ export class WorkspaceIndicator extends PanelMenu.Button {
}
}
- _updateActiveThumbnail() {
- let thumbs = this._thumbnailsBox.get_children();
- for (let i = 0; i < thumbs.length; i++) {
- if (i === this._currentWorkspace)
- thumbs[i].add_style_class_name('active');
- else
- thumbs[i].remove_style_class_name('active');
- }
- }
-
_getStatusText() {
const {nWorkspaces} = global.workspace_manager;
const current = this._currentWorkspace + 1;
@@ -436,7 +448,6 @@ export class WorkspaceIndicator extends PanelMenu.Button {
let thumb = new WorkspaceThumbnail(i);
this._thumbnailsBox.add_child(thumb);
}
- this._updateActiveThumbnail();
}
_activate(index) {
--
2.44.0