diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-16 00:45:53 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-16 00:46:53 +0800 |
| commit | 3b22c27a87f87c2965af683a0d55f48480fab02d (patch) | |
| tree | 115754b02bd55159f941b72c584126184a3ab340 | |
| parent | 3352b13c1116764e30d464226b0dfc8423a0c295 (diff) | |
mpris: preferedplayer
| -rw-r--r-- | bar/Mpris.qml | 3 | ||||
| -rw-r--r-- | config/Bar.qml | 1 | ||||
| -rw-r--r-- | services/Mpris.qml | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/bar/Mpris.qml b/bar/Mpris.qml index 81a9bc8..a2895aa 100644 --- a/bar/Mpris.qml +++ b/bar/Mpris.qml @@ -77,9 +77,8 @@ Item { MouseArea { anchors.fill: parent acceptedButtons: Qt.MiddleButton | Qt.RightButton - onClicked: { + onClicked: mouse => { if (mouse.button === Qt.MiddleButton) { - console.log("Middle button clicked"); root.activePlayer?.togglePlaying(); } else if (mouse.button === Qt.RightButton) { root.activePlayer?.next(); diff --git a/config/Bar.qml b/config/Bar.qml index 39090e7..6687552 100644 --- a/config/Bar.qml +++ b/config/Bar.qml @@ -38,6 +38,7 @@ Singleton { readonly property int moduleRadius: Style.rounding.small readonly property double mediaPausedOpacity: 0.8 + readonly property string preferedPlayer: "spotify" readonly property double bgTransparency: 0.25 } diff --git a/services/Mpris.qml b/services/Mpris.qml index 9618459..324103d 100644 --- a/services/Mpris.qml +++ b/services/Mpris.qml @@ -10,13 +10,15 @@ import Quickshell import Quickshell.Io import Quickshell.Services.Mpris +import qs.config + /** * A service that provides easy access to the active Mpris player. */ Singleton { id: root property MprisPlayer trackedPlayer: null - property MprisPlayer activePlayer: trackedPlayer ?? Mpris.players.values[0] ?? null + property MprisPlayer activePlayer: Mpris.players.values.find(i => i.desktopEntry === Bar.preferedPlayer) ?? trackedPlayer ?? Mpris.players.values[0] ?? null signal trackChanged(reverse: bool) property bool __reverse: false |
