diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index a228005..4d48646 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -37,6 +37,13 @@ Variants { } RowLayout { id: rightLayout + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: 5 + anchors.rightMargin: 10 + Mpris { + barHeight: root.implicitHeight + } } } } diff --git a/modules/bar/Mpris.qml b/modules/bar/Mpris.qml index ca9057a..8dd80b3 100644 --- a/modules/bar/Mpris.qml +++ b/modules/bar/Mpris.qml @@ -1,8 +1,31 @@ -import Quickshell.Mpris +import Quickshell.Services.Mpris import Quickshell.Widgets import QtQuick import QtQuick.Layouts import qs import qs.widgets -WrapperRectangle {} +WrapperRectangle { + id: root + property MprisPlayer spotify: findSpotify() + required property int barHeight + property double vertMargin: barHeight / 4 - 4 + visible: spotify != null + topMargin: vertMargin + bottomMargin: vertMargin + leftMargin: 8 + rightMargin: 8 + color: Colors.base01 + function findSpotify() { + for (let i = 0; i < Mpris.players.values.length; i++) { + let current = Mpris.players.values[i]; + if (current.identity == 'spotify' || 'Spotify') { + return current; + } + } + return null; + } + StyledText { + text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists + } +}