Skip to content

Add the ability to scroll on the workspace indicator and icons container. #8917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions src/zen/workspaces/ZenWorkspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,17 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
workspaceWrapper.pinnedTabsContainer,
tabs
);
this.initIndicatorContextMenu(workspaceWrapper.indicator);
workspaceWrapper.indicator.addEventListener('wheel', (event) => {
const isTrackpad =
(event.wheelDeltaY && event.wheelDeltaY === event.deltaY * -3) ||
event.deltaMode === 0;

const verticalScroll = Math.abs(event.deltaY) > Math.abs(event.deltaX);
if ((isTrackpad && verticalScroll) || !isTrackpad) {
this.scrollInDirection(event.deltaY);
}
});
resolve();
},
{ once: true }
Expand Down Expand Up @@ -549,6 +560,14 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
});
}

scrollInDirection(delta) {
// Determine scroll direction
const rawDirection = delta > 0 ? 1 : -1;

const direction = this.naturalScroll ? -1 : 1;
this.changeWorkspaceShortcut(rawDirection * direction);
}

_setupSidebarHandlers() {
const toolbox = gNavToolbox;

Expand Down Expand Up @@ -590,11 +609,7 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
const delta = isVerticalScroll ? event.deltaY : event.deltaX;
if (Math.abs(delta) < scrollThreshold) return;

// Determine scroll direction
let rawDirection = delta > 0 ? 1 : -1;

let direction = this.naturalScroll ? -1 : 1;
this.changeWorkspaceShortcut(rawDirection * direction);
this.scrollInDirection(delta);

this._lastScrollTime = currentTime;
},
Expand Down