diff --git a/.config/quickshell/ii/modules/common/widgets/StyledFlickable.qml b/.config/quickshell/ii/modules/common/widgets/StyledFlickable.qml index 14b3af03c..b077e141d 100644 --- a/.config/quickshell/ii/modules/common/widgets/StyledFlickable.qml +++ b/.config/quickshell/ii/modules/common/widgets/StyledFlickable.qml @@ -1,6 +1,24 @@ import QtQuick Flickable { + id: root maximumFlickVelocity: 3500 boundsBehavior: Flickable.DragOverBounds + + property real touchpadScrollFactor: 100 + property real mouseScrollFactor: 50 + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + onWheel: function(wheelEvent) { + var delta = wheelEvent.angleDelta.y / 120; + // The angleDelta.y of a touchpad is usually small and continuous, + // while that of a mouse wheel is typically in multiples of ±120. + var scrollFactor = Math.abs(wheelEvent.angleDelta.y) >= 120 ? root.mouseScrollFactor : root.touchpadScrollFactor; + var targetY = root.contentY - delta * scrollFactor; + targetY = Math.max(0, Math.min(targetY, root.contentHeight - root.height)); + root.contentY = targetY; + } + } } diff --git a/.config/quickshell/ii/modules/common/widgets/StyledListView.qml b/.config/quickshell/ii/modules/common/widgets/StyledListView.qml index 7021f24a4..c6119fcc0 100644 --- a/.config/quickshell/ii/modules/common/widgets/StyledListView.qml +++ b/.config/quickshell/ii/modules/common/widgets/StyledListView.qml @@ -15,6 +15,9 @@ ListView { property real dragDistance: 0 property bool popin: true + property real touchpadScrollFactor: 100 + property real mouseScrollFactor: 50 + function resetDrag() { root.dragIndex = -1 root.dragDistance = 0 @@ -23,6 +26,20 @@ ListView { maximumFlickVelocity: 3500 boundsBehavior: Flickable.DragOverBounds + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + onWheel: function(wheelEvent) { + var delta = wheelEvent.angleDelta.y / 120; + // The angleDelta.y of a touchpad is usually small and continuous, + // while that of a mouse wheel is typically in multiples of ±120. + var scrollFactor = Math.abs(wheelEvent.angleDelta.y) >= 120 ? root.mouseScrollFactor : root.touchpadScrollFactor; + var targetY = root.contentY - delta * scrollFactor; + targetY = Math.max(0, Math.min(targetY, root.contentHeight - root.height)); + root.contentY = targetY; + } + } + add: Transition { animations: [ Appearance?.animation.elementMove.numberAnimation.createObject(this, { diff --git a/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml b/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml index dcbff893e..9120a8f72 100644 --- a/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml +++ b/.config/quickshell/ii/modules/sidebarLeft/AiChat.qml @@ -282,6 +282,9 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\) spacing: 10 popin: false + touchpadScrollFactor: 600 + mouseScrollFactor: 200 + property int lastResponseLength: 0 clip: true diff --git a/.config/quickshell/ii/modules/sidebarLeft/Anime.qml b/.config/quickshell/ii/modules/sidebarLeft/Anime.qml index a72837725..07575ca36 100644 --- a/.config/quickshell/ii/modules/sidebarLeft/Anime.qml +++ b/.config/quickshell/ii/modules/sidebarLeft/Anime.qml @@ -137,6 +137,9 @@ Item { anchors.fill: parent spacing: 10 + touchpadScrollFactor: 600 + mouseScrollFactor: 200 + property int lastResponseLength: 0 clip: true