Fixed an issue that would cause the scroll direction to be inverted on secondary monitors. (#683)

* Fixed an issue that would cause the scroll direction to be inverted on secondary monitors.

* Update import paths and tsconfig.
This commit is contained in:
Jas Singh
2024-12-31 03:20:47 -08:00
committed by GitHub
parent 7204ba657b
commit 210d5e2a5e
35 changed files with 49 additions and 97 deletions

View File

@@ -1,5 +1,5 @@
import options from 'src/options';
import { initThrottledScrollHandlers, getWorkspacesForMonitor } from './helpers';
import { initThrottledScrollHandlers } from './helpers';
import { BarBoxChild } from 'src/lib/types/bar';
import { WorkspaceModule } from './workspaces';
import { bind, Variable } from 'astal';
@@ -7,15 +7,9 @@ import { GtkWidget } from 'src/lib/types/widget';
import { Astal, Gdk } from 'astal/gtk3';
import { isScrollDown, isScrollUp } from 'src/lib/utils';
const { workspaces, scroll_speed } = options.bar.workspaces;
const { scroll_speed } = options.bar.workspaces;
const Workspaces = (monitor = -1): BarBoxChild => {
const currentMonitorWorkspaces = Variable(getWorkspacesForMonitor(monitor));
workspaces.subscribe(() => {
currentMonitorWorkspaces.set(getWorkspacesForMonitor(monitor));
});
const component = (
<box className={'workspaces-box-container'}>
<WorkspaceModule monitor={monitor} />
@@ -35,18 +29,15 @@ const Workspaces = (monitor = -1): BarBoxChild => {
self.disconnect(scrollHandlers);
}
const { throttledScrollUp, throttledScrollDown } = initThrottledScrollHandlers(
scroll_speed,
currentMonitorWorkspaces,
);
const { throttledScrollUp, throttledScrollDown } = initThrottledScrollHandlers(scroll_speed);
scrollHandlers = self.connect('scroll-event', (_: GtkWidget, event: Gdk.Event) => {
if (isScrollUp(event)) {
throttledScrollDown();
throttledScrollUp();
}
if (isScrollDown(event)) {
throttledScrollUp();
throttledScrollDown();
}
});
});