From 0a33022c6ab818941bec750e0e41a99a2d8a5c4b Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Wed, 27 Aug 2025 16:04:15 -0400 Subject: [PATCH] simple dashboard only has mpris --- constants/Icons.qml | 2 + modules/Shell.qml | 2 + modules/bar/components/Mpris.qml | 28 +---------- modules/drawers/Drawers.qml | 41 ++++++++++++++++ modules/drawers/dashboard/Dashboard.qml | 63 +++++++++++++++++++++++++ services/Visibility.qml | 2 + 6 files changed, 111 insertions(+), 27 deletions(-) create mode 100644 modules/drawers/Drawers.qml create mode 100644 modules/drawers/dashboard/Dashboard.qml diff --git a/constants/Icons.qml b/constants/Icons.qml index 2e077d2..d00c970 100644 --- a/constants/Icons.qml +++ b/constants/Icons.qml @@ -13,6 +13,8 @@ Singleton { property string bluetoothConnected: "\u{E1b8}" property string brickWall: "\u{E586}" property string coffee: "\u{E09a}" + property string chevronLeft: "\u{E072}" + property string chevronRight: "\u{E073}" property string cpu: "\u{E0ad}" property string gpu: "\u{E66f}" property string hardDrive: "\u{E0f1}" diff --git a/modules/Shell.qml b/modules/Shell.qml index ed1e550..41e7643 100644 --- a/modules/Shell.qml +++ b/modules/Shell.qml @@ -1,4 +1,5 @@ import "bar" +import "drawers" import "launcher" import "pomodoro" import "powermenu" @@ -19,5 +20,6 @@ Variants { Pomodoro {} PowerMenu {} Storybook {} + Drawers {} } } diff --git a/modules/bar/components/Mpris.qml b/modules/bar/components/Mpris.qml index 6ab1275..2c7c456 100644 --- a/modules/bar/components/Mpris.qml +++ b/modules/bar/components/Mpris.qml @@ -10,17 +10,8 @@ import QtQuick.Layouts StyledButton { id: root - padding: 6 - onClicked: { - if (!Mpris.active.canTogglePlaying) { - return; - } - if (Mpris.active.isPlaying) { - Mpris.active.pause(); - } else { - Mpris.active.play(); - } + Visibility.dashboard = !Visibility.dashboard; } content: ColumnLayout { @@ -56,22 +47,5 @@ StyledButton { } } } - StyledSlider { - from: 0 - to: Mpris.active?.length ?? 0 - value: Mpris.active?.position - implicitHeight: 6 - Layout.fillWidth: true - onMoved: { - Mpris.active.position = value; - } - - Timer { - running: Mpris.active?.isPlaying - interval: 1000 - repeat: true - onTriggered: Mpris.active?.positionChanged() - } - } } } diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml new file mode 100644 index 0000000..34b5c31 --- /dev/null +++ b/modules/drawers/Drawers.qml @@ -0,0 +1,41 @@ +import "dashboard" +import QtQuick +import Quickshell +import Quickshell.Wayland + +PanelWindow { + id: parentWindow + + anchors.top: true + anchors.left: true + anchors.right: true + anchors.bottom: true + + color: 'transparent' + + // WlrLayershell.exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Top + + mask: Region { + width: parentWindow.width + height: parentWindow.height + intersection: Intersection.Xor + regions: [ + Region { + x: dashboard.x + y: dashboard.y + width: dashboard.width + height: dashboard.height + intersection: Intersection.Subtract + } + ] + } + + Dashboard { + id: dashboard + x: parentWindow.width / 2 - dashboard.width / 2 + edge: Qt.TopEdge + padding: 20 + margins: 200 + } +} diff --git a/modules/drawers/dashboard/Dashboard.qml b/modules/drawers/dashboard/Dashboard.qml new file mode 100644 index 0000000..d24f8a9 --- /dev/null +++ b/modules/drawers/dashboard/Dashboard.qml @@ -0,0 +1,63 @@ +pragma ComponentBehavior: Bound + +import qs.components +import qs.config +import qs.constants +import qs.services +import qs.widgets +import QtQuick +import QtQuick.Layouts + +StyledDrawer { + id: root + + visible: Visibility.dashboard + + margins: 20 + contentItem: ColumnLayout { + + 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(" "); + } + 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 + } + } +} diff --git a/services/Visibility.qml b/services/Visibility.qml index b3a2678..d8deed4 100644 --- a/services/Visibility.qml +++ b/services/Visibility.qml @@ -4,6 +4,7 @@ import qs.widgets import Quickshell Singleton { + property alias dashboard: properties.dashboard property alias launcher: properties.launcher property alias pomodoro: properties.pomodoro property alias powermenu: properties.powermenu @@ -21,6 +22,7 @@ Singleton { PersistentProperties { id: properties + property bool dashboard property bool launcher property bool pomodoro property bool powermenu