diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-16 15:10:08 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-16 15:10:08 +0800 |
| commit | c95abd061904ea7300a6d6b5a72a80efe2d57b86 (patch) | |
| tree | 67ddc65720ae0ae53f61975c2adbf91cabd2a6b5 /bar/Mpris.qml | |
| parent | a1037d32e377c388ed30ce9d4a5b02bc7b040362 (diff) | |
mpris: directly use position / length instead of calculating a progress
Diffstat (limited to 'bar/Mpris.qml')
| -rw-r--r-- | bar/Mpris.qml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/bar/Mpris.qml b/bar/Mpris.qml index 31c984c..b213721 100644 --- a/bar/Mpris.qml +++ b/bar/Mpris.qml @@ -12,7 +12,6 @@ import qs.components Item { id: root readonly property MprisPlayer activePlayer: Services.Mpris.activePlayer - readonly property real progress: (activePlayer?.positionSupported && activePlayer?.lengthSupported && activePlayer.length > 0) ? activePlayer.position / activePlayer.length : 0 readonly property string cleanedTitle: cleanMusicTitle(activePlayer?.trackTitle) function cleanMusicTitle(title) { @@ -46,8 +45,8 @@ Item { handle: Item from: 0 - to: 1 - value: root.progress + to: activePlayer?.length || 0 + value: activePlayer?.position || 0 background: Rectangle { anchors.fill: parent color: WallustColors.color4 @@ -69,8 +68,8 @@ Item { } onMoved: { - if (Math.round(root.activePlayer.position) !== Math.round(value * root.activePlayer.length)) { - root.activePlayer.position = value * root.activePlayer.length; + if (Math.round(root.activePlayer.position) !== Math.round(value)) { + root.activePlayer.position = value; } } |
