diff --git a/wsmatrix@martin.zurowietz.de/prefs.js b/wsmatrix@martin.zurowietz.de/prefs.js
index 0404851..597861b 100644
--- a/wsmatrix@martin.zurowietz.de/prefs.js
+++ b/wsmatrix@martin.zurowietz.de/prefs.js
@@ -37,6 +37,8 @@ export default class Prefs extends ExtensionPreferences {
'Next/Previous Bordered',
], settings));
+ group.add(this._createSwitcherRow('Force horizontal scroll', 'force-horizontal-scroll', settings));
+
group = new Adw.PreferencesGroup({
title: _('Popup Settings'),
});
diff --git a/wsmatrix@martin.zurowietz.de/schemas/gschemas.compiled b/wsmatrix@martin.zurowietz.de/schemas/gschemas.compiled
index abefe50..c512788 100644
Binary files a/wsmatrix@martin.zurowietz.de/schemas/gschemas.compiled and b/wsmatrix@martin.zurowietz.de/schemas/gschemas.compiled differ
diff --git a/wsmatrix@martin.zurowietz.de/schemas/org.gnome.shell.extensions.wsmatrix.gschema.xml b/wsmatrix@martin.zurowietz.de/schemas/org.gnome.shell.extensions.wsmatrix.gschema.xml
index 5118e8e..27809e9 100644
--- a/wsmatrix@martin.zurowietz.de/schemas/org.gnome.shell.extensions.wsmatrix.gschema.xml
+++ b/wsmatrix@martin.zurowietz.de/schemas/org.gnome.shell.extensions.wsmatrix.gschema.xml
@@ -16,6 +16,10 @@
Number of rows of workspaces
+
+ false
+ Whether to force workspace scrolling to only work horizontally
+
true
Whether to show the popup or not
diff --git a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js
index 9347533..afee03a 100644
--- a/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js
+++ b/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js
@@ -29,6 +29,8 @@ export default class WorkspaceManagerOverride {
this._overviewKeybindingActions = {};
this.monitors = [];
+ global._forceHorizontalScroll = this.settings.get_boolean('force-horizontal-scroll');
+
this._workspaceAnimation = new WorkspaceAnimationController();
this.overrideProperties = [
'_workspaceAnimation',
@@ -129,6 +131,11 @@ export default class WorkspaceManagerOverride {
'changed::enable-popup-workspace-hover',
this._destroyWorkspaceSwitcherPopup.bind(this)
);
+
+ this.settingsHandlerForceHorizontalScroll = this.settings.connect(
+ 'changed::force-horizontal-scroll',
+ this._handleForceHorizontalScrollChanged.bind(this)
+ );
}
_disconnectSettings() {
@@ -141,6 +148,7 @@ export default class WorkspaceManagerOverride {
this.settings.disconnect(this.settingsHandlerWraparoundMode);
this.settings.disconnect(this.settingsHandlerShowWorkspaceNames);
this.settings.disconnect(this.settingsHandlerEnablePopupWorkspaceHover);
+ this.settings.disconnect(this.settingsHandlerForceHorizontalScroll);
}
_connectLayoutManager() {
@@ -331,24 +339,46 @@ export default class WorkspaceManagerOverride {
const workspaceManager = global.workspace_manager;
const activeWs = workspaceManager.get_active_workspace();
+ const currentIndex = workspaceManager.get_active_workspace_index();
+ const forceHorizontalScroll = global._forceHorizontalScroll;
let ws;
switch (direction) {
case Clutter.ScrollDirection.UP:
- ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
+ if (forceHorizontalScroll) {
+ ws = workspaceManager.get_workspace_by_index(currentIndex - 1);
+ } else {
+ ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
+ }
break;
case Clutter.ScrollDirection.LEFT:
- ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
+ if (forceHorizontalScroll) {
+ ws = workspaceManager.get_workspace_by_index(currentIndex - 1);
+ } else {
+ ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
+ }
break;
case Clutter.ScrollDirection.DOWN:
- ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
+ if (forceHorizontalScroll) {
+ ws = workspaceManager.get_workspace_by_index(currentIndex + 1);
+ } else {
+ ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
+ }
break;
case Clutter.ScrollDirection.RIGHT:
- ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
+ if (forceHorizontalScroll) {
+ ws = workspaceManager.get_workspace_by_index(currentIndex + 1);
+ } else {
+ ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
+ }
break;
default:
return Clutter.EVENT_PROPAGATE;
}
+ if (ws == null) {
+ return Clutter.EVENT_PROPAGATE;
+ }
+
this.actionMoveWorkspace(ws);
this._canScroll = false;
@@ -493,6 +523,10 @@ export default class WorkspaceManagerOverride {
this.wm._wsPopupList.filter(p => p).forEach(p => p.destroy());
}
+ _handleForceHorizontalScrollChanged() {
+ global._forceHorizontalScroll = this.settings.get_boolean('force-horizontal-scroll');
+ }
+
_getTargetWorkspace(direction) {
let newWs = this.wsManager.get_active_workspace().get_neighbor(direction);
let currentIndex = this.wsManager.get_active_workspace_index();