summaryrefslogtreecommitdiff
path: root/bar
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-16 00:27:25 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-16 00:46:52 +0800
commita99a595ed3fda535e53f4aa455a57ff87d6122a5 (patch)
tree61c4d82a236f90a4b9b413476ca2d1e9b4d18afa /bar
parent7469851c2cc680f3dcf3f680441747596257dfeb (diff)
mpris: mouse support
Diffstat (limited to 'bar')
-rw-r--r--bar/Mpris.qml26
1 files changed, 25 insertions, 1 deletions
diff --git a/bar/Mpris.qml b/bar/Mpris.qml
index 90eab1f..2ec644e 100644
--- a/bar/Mpris.qml
+++ b/bar/Mpris.qml
@@ -40,9 +40,11 @@ Item {
radius: Style.rounding.smaller
color: "transparent"
- ProgressBar {
+ Slider {
id: pBar
anchors.fill: parent
+
+ handle: Item
from: 0
to: 1
value: root.progress
@@ -65,6 +67,25 @@ Item {
}
}
}
+
+ onMoved: {
+ if (Math.round(root.activePlayer.position) !== Math.round(value * root.activePlayer.length)) {
+ root.activePlayer.position = value * root.activePlayer.length;
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.MiddleButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button === Qt.MiddleButton) {
+ console.log("Middle button clicked");
+ root.activePlayer?.togglePlaying();
+ } else if (mouse.button === Qt.RightButton) {
+ root.activePlayer?.next();
+ }
+ }
+ }
}
RowLayout {
@@ -81,7 +102,10 @@ Item {
anchors.fill: parent
source: activePlayer?.trackArtUrl
fillMode: Image.PreserveAspectFit
+ antialiasing: true
+ asynchronous: true
visible: false
+ cache: false
}
Rectangle {
id: mask