From f597ea994818632a26f05814b336b2b33effc8ae Mon Sep 17 00:00:00 2001 From: nebu <87451010+nebunebu@users.noreply.github.com> Date: Sat, 8 Nov 2025 17:33:35 -0500 Subject: [PATCH] HyprKeybindsModal: add scrollability (#668) --- Modals/HyprKeybindsModal.qml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Modals/HyprKeybindsModal.qml b/Modals/HyprKeybindsModal.qml index cf0d3d0c..7d81f4cb 100644 --- a/Modals/HyprKeybindsModal.qml +++ b/Modals/HyprKeybindsModal.qml @@ -10,13 +10,33 @@ DankModal { id: root layerNamespace: "dms:hyprkeybinds" - + property real scrollStep: 60 + property var activeFlickable: null property real _maxW: Math.min(Screen.width * 0.92, 1200) property real _maxH: Math.min(Screen.height * 0.92, 900) width: _maxW height: _maxH onBackgroundClicked: close() + function scrollDown() { + if (!root.activeFlickable) return + let newY = root.activeFlickable.contentY + scrollStep + newY = Math.min(newY, root.activeFlickable.contentHeight - root.activeFlickable.height) + root.activeFlickable.contentY = newY + } + + function scrollUp() { + if (!root.activeFlickable) return + let newY = root.activeFlickable.contentY - root.scrollStep + newY = Math.max(0, newY) + root.activeFlickable.contentY = newY + } + + + Shortcut { sequence: "Ctrl+j"; onActivated: root.scrollDown() } + Shortcut { sequence: "Down"; onActivated: root.scrollDown() } + Shortcut { sequence: "Ctrl+k"; onActivated: root.scrollUp() } + Shortcut { sequence: "Up"; onActivated: root.scrollUp() } Shortcut { sequence: "Esc"; onActivated: root.close() } function categorizeKeybinds() { @@ -105,6 +125,9 @@ DankModal { contentHeight: rowLayout.implicitHeight clip: true + Component.onCompleted: root.activeFlickable = mainFlickable + Component.onDestruction: root.activeFlickable = null + Row { id: rowLayout spacing: Theme.spacingM