109 lines
4.6 KiB
Diff
109 lines
4.6 KiB
Diff
From f611e1e505005a9f24a1babe66cb60f6ec610b57 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
Date: Tue, 3 Mar 2026 12:48:13 +0100
|
|
Subject: [PATCH 1/2] workspace-indicator: Use section box to iterate items
|
|
|
|
Menu items are added to a menu's box, so it is more correct to
|
|
use that to access items, even when for menu sections the box
|
|
is also used as the menu's actor.
|
|
|
|
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/445>
|
|
---
|
|
extensions/workspace-indicator/workspaceIndicator.js | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/extensions/workspace-indicator/workspaceIndicator.js b/extensions/workspace-indicator/workspaceIndicator.js
|
|
index b2e79508..702bd830 100644
|
|
--- a/extensions/workspace-indicator/workspaceIndicator.js
|
|
+++ b/extensions/workspace-indicator/workspaceIndicator.js
|
|
@@ -545,7 +545,7 @@ class WorkspacesMenu extends PopupMenu.PopupMenu {
|
|
const {workspaceManager} = global;
|
|
const {nWorkspaces} = workspaceManager;
|
|
|
|
- const section = this._workspacesSection.actor;
|
|
+ const section = this._workspacesSection.box;
|
|
while (section.get_n_children() < nWorkspaces) {
|
|
const item = new EditableMenuItem();
|
|
item.connect('activate', (o, event) => {
|
|
@@ -570,7 +570,7 @@ class WorkspacesMenu extends PopupMenu.PopupMenu {
|
|
}
|
|
|
|
_updateWorkspaceLabels() {
|
|
- const items = [...this._workspacesSection.actor];
|
|
+ const items = [...this._workspacesSection.box];
|
|
items.forEach(
|
|
(item, i) => (item.label.text = Meta.prefs_get_workspace_name(i)));
|
|
}
|
|
@@ -579,7 +579,7 @@ class WorkspacesMenu extends PopupMenu.PopupMenu {
|
|
const {workspaceManager} = global;
|
|
const active = workspaceManager.get_active_workspace_index();
|
|
|
|
- const items = [...this._workspacesSection.actor];
|
|
+ const items = [...this._workspacesSection.box];
|
|
items.forEach((item, i) => {
|
|
item.setOrnament(i === active
|
|
? PopupMenu.Ornament.CHECK
|
|
--
|
|
2.53.0
|
|
|
|
|
|
From e79cc879b41202212aa4b7afb590a6c0921cefab Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
Date: Mon, 2 Mar 2026 18:49:16 +0100
|
|
Subject: [PATCH 2/2] workspace-indicator: Support scrolling in workspace menu
|
|
|
|
While we should always have enough screen estate to fit a reasonable
|
|
number of workspaces, the number can go up to 36 where we are pretty
|
|
much guaranteed to run out of space.
|
|
|
|
Support those less common cases by making the workspace list scrollable.
|
|
|
|
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/445>
|
|
---
|
|
.../workspace-indicator/workspaceIndicator.js | 15 +++++++++++++++
|
|
1 file changed, 15 insertions(+)
|
|
|
|
diff --git a/extensions/workspace-indicator/workspaceIndicator.js b/extensions/workspace-indicator/workspaceIndicator.js
|
|
index 702bd830..d855474e 100644
|
|
--- a/extensions/workspace-indicator/workspaceIndicator.js
|
|
+++ b/extensions/workspace-indicator/workspaceIndicator.js
|
|
@@ -17,6 +17,7 @@ import * as DND from 'resource:///org/gnome/shell/ui/dnd.js';
|
|
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
|
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
|
|
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
|
|
+import {ensureActorVisibleInScrollView} from 'resource:///org/gnome/shell/misc/animationUtils.js';
|
|
|
|
const TOOLTIP_OFFSET = 6;
|
|
const TOOLTIP_ANIMATION_TIME = 150;
|
|
@@ -511,6 +512,15 @@ class WorkspacesMenu extends PopupMenu.PopupMenu {
|
|
this.actor.add_style_class_name(`${baseStyleClassName}-menu`);
|
|
|
|
this._workspacesSection = new PopupMenu.PopupMenuSection();
|
|
+
|
|
+ // make the section scrollable to avoid growing indefinitely
|
|
+ const scrollView = new St.ScrollView({
|
|
+ style_class: 'vfade',
|
|
+ child: this._workspacesSection.box,
|
|
+ });
|
|
+ scrollView._delegate = this._workspacesSection;
|
|
+ this._workspacesSection.actor = scrollView;
|
|
+
|
|
this.addMenuItem(this._workspacesSection);
|
|
|
|
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
|
@@ -560,6 +570,11 @@ class WorkspacesMenu extends PopupMenu.PopupMenu {
|
|
this._desktopSettings.set_strv('workspace-names',
|
|
[...newNames, ...oldNames.slice(nLabels)]);
|
|
});
|
|
+ item.connect('notify::active', () => {
|
|
+ const view = this._workspacesSection.actor;
|
|
+ if (item.active)
|
|
+ ensureActorVisibleInScrollView(view, item);
|
|
+ });
|
|
this._workspacesSection.addMenuItem(item);
|
|
}
|
|
|
|
--
|
|
2.53.0
|
|
|