diff options
Diffstat (limited to 'modules/sidebar/NotifGroupList.qml')
| -rw-r--r-- | modules/sidebar/NotifGroupList.qml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/sidebar/NotifGroupList.qml b/modules/sidebar/NotifGroupList.qml index 7def80f..675dc44 100644 --- a/modules/sidebar/NotifGroupList.qml +++ b/modules/sidebar/NotifGroupList.qml @@ -17,6 +17,8 @@ Item { readonly property int spacing: Math.round(Appearance.spacing.small / 2) property bool flag + signal requestToggleExpand(expand: bool) + Layout.fillWidth: true implicitHeight: { const item = repeater.itemAt(repeater.count - 1); @@ -56,16 +58,26 @@ Item { hoverEnabled: true cursorShape: pressed ? Qt.ClosedHandCursor : undefined - acceptedButtons: Qt.LeftButton | Qt.MiddleButton + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + preventStealing: true drag.target: this drag.axis: Drag.XAxis onPressed: event => { startY = event.y; - if (event.button === Qt.MiddleButton) + if (event.button === Qt.RightButton) + root.requestToggleExpand(!root.expanded); + else if (event.button === Qt.MiddleButton) modelData.close(); } + onPositionChanged: event => { + if (pressed) { + const diffY = event.y - startY; + if (Math.abs(diffY) > Config.notifs.expandThreshold) + root.requestToggleExpand(diffY > 0); + } + } onReleased: event => { if (Math.abs(x) < width * Config.notifs.clearThreshold) x = 0; |