diff --git a/modules/drawers/dashboard/Dashboard.qml b/modules/drawers/dashboard/Dashboard.qml index d24f8a9..ab1ce02 100644 --- a/modules/drawers/dashboard/Dashboard.qml +++ b/modules/drawers/dashboard/Dashboard.qml @@ -7,57 +7,61 @@ import qs.services import qs.widgets import QtQuick import QtQuick.Layouts +import Quickshell.Widgets StyledDrawer { id: root visible: Visibility.dashboard - margins: 20 - contentItem: ColumnLayout { + WrapperRectangle { + color: Theme.palette.base300 + radius: 8 + margin: 20 + ColumnLayout { + RowLayout { + Layout.alignment: Qt.AlignHCenter - RowLayout { - Layout.alignment: Qt.AlignHCenter - - StyledButton { - id: previousPlayerButton - visible: Mpris.players.length > 1 - content: LucideIcon { - color: previousPlayerButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent - text: Icons.chevronLeft - } - onClicked: { - Mpris.previousPlayer(); - } - } - - StyledText { - text: { - if (Mpris.active?.identity) { - const words = Mpris.active?.identity.split("-"); - const capitalized = words.map(val => String(val).charAt(0).toUpperCase() + String(val).slice(1)); - return capitalized.join(" "); + StyledButton { + id: previousPlayerButton + visible: Mpris.players.length > 1 + content: LucideIcon { + color: previousPlayerButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent + text: Icons.chevronLeft + } + onClicked: { + Mpris.previousPlayer(); + } + } + + StyledText { + text: { + if (Mpris.active?.identity) { + const words = Mpris.active?.identity.split("-"); + const capitalized = words.map(val => String(val).charAt(0).toUpperCase() + String(val).slice(1)); + return capitalized.join(" "); + } + return Mpris.active?.desktopEntry ?? Mpris.active?.dbusName ?? "unknown"; + } + font.pixelSize: 20 + } + + StyledButton { + id: nextPlayerButton + visible: Mpris.players.length > 1 + content: LucideIcon { + color: nextPlayerButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent + text: Icons.chevronRight + } + onClicked: { + Mpris.nextPlayer(); } - return Mpris.active?.desktopEntry ?? Mpris.active?.dbusName ?? "unknown"; } - font.pixelSize: 20 } - StyledButton { - id: nextPlayerButton - visible: Mpris.players.length > 1 - content: LucideIcon { - color: nextPlayerButton.containsMouse ? Theme.palette.primarycontent : Theme.palette.basecontent - text: Icons.chevronRight - } - onClicked: { - Mpris.nextPlayer(); - } + MprisController { + player: Mpris.active } } - - MprisController { - player: Mpris.active - } } } diff --git a/services/Mpris.qml b/services/Mpris.qml index b6ebadc..585bbd0 100644 --- a/services/Mpris.qml +++ b/services/Mpris.qml @@ -20,13 +20,14 @@ Singleton { if (players.length == 0) { return; } - properties.currentIndex = properties.currentIndex + 1 % players.length; + properties.currentIndex = (properties.currentIndex + 1) % players.length; } function previousPlayer() { if (players.length == 0) { return; } - properties.currentIndex = properties.currentIndex - 1 % players.length; + const newIndex = properties.currentIndex - 1; + properties.currentIndex = newIndex >= 0 ? newIndex : players.length - 1; } }