import Quickshell.Services.Mpris import Quickshell.Widgets import QtQuick import QtQuick.Layouts import qs import qs.widgets import qs.settings WrapperRectangle { id: root property MprisPlayer spotify: findSpotify() visible: spotify != null leftMargin: 8 rightMargin: 8 color: Colors.base01 radius: Config.rounding 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; } else { return null; } } return null; } child: WrapperMouseArea { id: clickHandler acceptedButtons: Qt.LeftButton | Qt.RightButton cursorShape: Qt.PointingHandCursor onClicked: mouse => { if (mouse.button == Qt.RightButton) { root.spotify.togglePlaying(); } } child: RowLayout { MaterialIcon { text: "music_note_2" } StyledText { Layout.maximumWidth: 400 text: root.spotify?.trackTitle + " - " + root.spotify?.trackArtists elide: Text.ElideRight } } } }