[gnome-shell-extensions] windowPicker: Adjust to gnome-shell changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] windowPicker: Adjust to gnome-shell changes
- Date: Thu, 9 Jan 2020 18:28:30 +0000 (UTC)
commit 25b6b562d93eec57b234281059f8424280563c4b
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jan 9 18:51:43 2020 +0100
windowPicker: Adjust to gnome-shell changes
WorkspacesDisplay now takes an adjustment for the workspace position,
provide that.
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/100
extensions/window-list/windowPicker.js | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/extensions/window-list/windowPicker.js b/extensions/window-list/windowPicker.js
index b1533da..25a689c 100644
--- a/extensions/window-list/windowPicker.js
+++ b/extensions/window-list/windowPicker.js
@@ -9,7 +9,22 @@ const { WorkspacesDisplay } = imports.ui.workspacesView;
let MyWorkspacesDisplay = GObject.registerClass(
class MyWorkspacesDisplay extends WorkspacesDisplay {
_init() {
- super._init();
+ let workspaceManager = global.workspace_manager;
+
+ this._workspaceAdjustment = new St.Adjustment({
+ value: workspaceManager.get_active_workspace_index(),
+ lower: 0,
+ page_increment: 1,
+ page_size: 1,
+ step_increment: 0,
+ upper: workspaceManager.n_workspaces,
+ });
+
+ this._nWorkspacesChangedId =
+ workspaceManager.connect('notify::n-workspaces',
+ this._updateAdjustment.bind(this));
+
+ super._init(this._workspaceAdjustment);
this.add_constraint(
new Layout.MonitorConstraint({
@@ -45,6 +60,14 @@ class MyWorkspacesDisplay extends WorkspacesDisplay {
this.setWorkspacesFullGeometry(workarea);
}
+ _updateAdjustment() {
+ let workspaceManager = global.workspace_manager;
+ this._workspaceAdjustment.set({
+ upper: workspaceManager.n_workspaces,
+ value: workspaceManager.get_active_workspace_index(),
+ });
+ }
+
_updateWorkspacesViews() {
super._updateWorkspacesViews();
@@ -59,6 +82,10 @@ class MyWorkspacesDisplay extends WorkspacesDisplay {
global.display.disconnect(this._workareasChangedId);
this._workareasChangedId = 0;
+ if (this._nWorkspacesChangedId)
+ global.workspace_manager.disconnect(this._nWorkspacesNotifyId),
+ this._nWorkspacesNotifyId = 0;
+
super._onDestroy();
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]