Skip to content

Commit cfc0a5d

Browse files
committed
feat: customizable drag distance
1 parent 69a842d commit cfc0a5d

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Spacer with Mouse gestures for the KDE Plasma Panel featuring Latte Dock/Gnome/U
3030
* [x] Mouse wheel up/down
3131
* [x] Min wheel steps
3232
* [x] Mouse drag (four axis)
33-
* [ ] Min track distance
33+
* [x] Min drag distance
3434
* [x] Long press
3535
* [ ] Hold duration
3636
* [x] Actions

package/contents/config/main.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@
155155
<entry name="contextMenuActions" type="String">
156156
<default>[{"action":"custom_command,Custom Command","command":"plasma-systemmonitor","url":"","icon":"utilities-system-monitor","name":"System Monitor"}]</default>
157157
</entry>
158+
<entry name="customDragDistanceEnabled" type="Bool">
159+
<default>false</default>
160+
</entry>
161+
<entry name="customDragDistance" type="Int">
162+
<default>10</default>
163+
</entry>
158164
</group>
159165

160166
</kcfg>

package/contents/ui/configBehavior.qml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ KCM.SimpleKCM {
1212
property alias cfg_showTooltip: showTooltip.checked
1313
property alias cfg_scrollSensitivity: scrollSensitivity.value
1414
property alias cfg_isContinuous: isContinuous.checked
15+
property alias cfg_customDragDistanceEnabled: customDragDistanceEnabled.checked
16+
property alias cfg_customDragDistance: customDragDistance.value
1517
property int cfg_notificationType
1618

1719
ColumnLayout {
@@ -52,6 +54,22 @@ KCM.SimpleKCM {
5254
}
5355
}
5456

57+
RowLayout {
58+
Kirigami.FormData.label: i18n("Custom drag distance:")
59+
CheckBox {
60+
id: customDragDistanceEnabled
61+
}
62+
KCM.ContextualHelpButton {
63+
toolTipText: i18n("Set the minimum drag distance (in pixels) to trigger the actions. By default, the distance is the same as the panel thickness.")
64+
}
65+
SpinBox {
66+
id: customDragDistance
67+
enabled: root.cfg_customDragDistanceEnabled
68+
from: 1
69+
to: 9999
70+
}
71+
}
72+
5573
Kirigami.Separator {
5674
Kirigami.FormData.isSection: true
5775
Kirigami.FormData.label: "Actions visual feedback"

package/contents/ui/main.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PlasmoidItem {
3535
property bool wasDoubleClicked: false
3636
// TODO make distance configurable instead??
3737
property bool doubleClickAllowed: doubleClickAction[0] !== "Disabled"
38-
property int minDragDistance: horizontal ? root.height : root.width
38+
property int minDragDistance: Plasmoid.configuration.customDragDistanceEnabled ? Plasmoid.configuration.customDragDistance : Math.min(root.height, root.width)
3939
property var mouseButton: undefined
4040

4141
property string toolsDir: Qt.resolvedUrl("./tools").toString().substring(7)

0 commit comments

Comments
 (0)