diff --git a/quickshell/core/ShellState.qml b/quickshell/core/ShellState.qml index 06a64ab..f0988ae 100644 --- a/quickshell/core/ShellState.qml +++ b/quickshell/core/ShellState.qml @@ -92,6 +92,19 @@ Singleton { else openNotch(); } + // Opens the notch straight onto a full view ("computer" or "equalizer"); + // asked again on that view, it closes. With the full bar, the matching + // dashboard tab opens instead. + function toggleNotchView(view) { + if (!notchMode) + return toggleDashboard(view === "computer" ? "performance" : "media"); + if (notchOpen && notchView === view) { + notchOpen = false; + return; + } + openNotch(); + notchView = view; + } onNotchModeChanged: if (!notchMode) notchOpen = false // Super+N: swaps between notch mode and the full bar. diff --git a/quickshell/notch/Notch.qml b/quickshell/notch/Notch.qml index ba2f34e..e60cad7 100644 --- a/quickshell/notch/Notch.qml +++ b/quickshell/notch/Notch.qml @@ -18,7 +18,8 @@ import "../widgets/faces" as Faces // notch at the top edge into three columns: a dashboard pager on the left // (Media, Performance, Calendar; the wheel moves between them), the Control // Center tiles and weather in the middle, and notifications on the right. -// Clicking Performance swaps in the full "Your computer" view. +// Clicking Performance swaps in the full "Your computer" view, and clicking +// the album art swaps in the EasyEffects equalizer. // The layer is sized to the shape so HyprGlass follows its outline. // qmllint disable uncreatable-type PanelWindow { @@ -29,6 +30,12 @@ PanelWindow { readonly property real screenHeight: screen ? screen.height : 1080 readonly property var options: ConfigService.ready ? ConfigService.data.notch : null readonly property bool computer: ShellState.notchView === "computer" + readonly property bool equalizer: ShellState.notchView === "equalizer" + // A full view replaces the three columns. + readonly property bool detail: computer || equalizer + readonly property bool equalizerShown: ShellState.notchOpen && equalizer + onEqualizerShownChanged: if (equalizerShown) + EasyEffectsService.refresh() readonly property real ear: BarDrawers.ear readonly property real band: BarDrawers.bottom readonly property int pad: 22 @@ -42,11 +49,11 @@ PanelWindow { // Open size of each view, then the morph between the pill and that size. readonly property real mainWidth: 2 * sideWidth + middleWidth + 2 * columnGap + 2 * pad readonly property real mainHeight: Math.max(600, middle.contentHeight + header + gutter + pad) - readonly property Item computerItem: computerLoader.item as Item - readonly property real computerWidth: (computerItem ? computerItem.implicitWidth : 800) + 2 * pad - readonly property real computerHeight: band + 44 + (computerItem ? computerItem.implicitHeight : 400) + pad - readonly property real openWidth: Math.min(screenWidth - 2 * (BarDrawers.margin + ear) - 40, computer ? computerWidth : mainWidth) - readonly property real openHeight: Math.min(screenHeight - 40, computer ? computerHeight : mainHeight) + readonly property Item detailItem: (equalizer ? equalizerView.item : computerView.item) as Item + readonly property real detailWidth: (detailItem ? detailItem.implicitWidth : equalizer ? 400 : 800) + 2 * pad + readonly property real detailHeight: band + 44 + (detailItem ? detailItem.implicitHeight : 400) + pad + readonly property real openWidth: Math.min(screenWidth - 2 * (BarDrawers.margin + ear) - 40, detail ? detailWidth : mainWidth) + readonly property real openHeight: Math.min(screenHeight - 40, detail ? detailHeight : mainHeight) property real progress: ShellState.notchOpen ? 1 : 0 Behavior on progress { NumberAnimation { @@ -187,7 +194,7 @@ PanelWindow { Keys.onEscapePressed: { if (middle.editing) middle.editing = false; - else if (root.computer) + else if (root.detail) ShellState.notchView = "main"; else ShellState.notchOpen = false; @@ -227,7 +234,7 @@ PanelWindow { // Header: chosen bar modules left of the clock (the wheel scrolls them // sideways), the tile editor cog, and a divider under it all. - readonly property bool headerShown: !root.computer && root.contentOpacity > 0 + readonly property bool headerShown: !root.detail && root.contentOpacity > 0 Flickable { id: strip objectName: "notchStrip" @@ -332,7 +339,7 @@ PanelWindow { width: root.mainWidth - 2 * root.pad height: root.targetHeight - root.header - root.gutter - root.pad visible: opacity > 0 - opacity: root.computer ? 0 : root.contentOpacity + opacity: root.detail ? 0 : root.contentOpacity Behavior on opacity { enabled: root.settled NumberAnimation { @@ -1010,55 +1017,75 @@ PanelWindow { } } - // "Your computer": the dashboard's Performance tab ------------------- - Item { + // Full views: "Your computer" (the dashboard's Performance tab) and + // the dashboard's EasyEffects equalizer ------------------------------ + DetailView { id: computerView - x: root.pad - y: root.band - width: root.bodyWidth - 2 * root.pad - height: Math.max(0, root.bodyHeight - root.band - root.pad) - visible: opacity > 0 - opacity: root.computer ? root.contentOpacity : 0 - Behavior on opacity { - enabled: root.settled - NumberAnimation { - duration: Theme.notchDuration - } + view: "computer" + title: "Your computer" + source: DashboardRegistry.entry("performance").source + } + DetailView { + id: equalizerView + view: "equalizer" + title: "Equalizer" + source: Qt.resolvedUrl("../dashboard/Equalizer.qml") + } + } + + // A full view: a back pill over the loaded page, shown while it is the + // notch's view. + component DetailView: Item { + id: detailView + required property string view + property string title + property alias source: detailLoader.source + readonly property bool shown: ShellState.notchView === view + readonly property var item: detailLoader.item + x: root.pad + y: root.band + width: root.bodyWidth - 2 * root.pad + height: Math.max(0, root.bodyHeight - root.band - root.pad) + visible: opacity > 0 + opacity: shown ? root.contentOpacity : 0 + Behavior on opacity { + enabled: root.settled + NumberAnimation { + duration: Theme.notchDuration } - Rectangle { - id: back - objectName: "notchBack" - width: backLabel.implicitWidth + 28 - height: 30 - radius: 15 - color: backArea.containsMouse ? Theme.hover : Theme.fill - border.width: 1 - border.color: Theme.hairline - Text { - id: backLabel - anchors.centerIn: parent - text: (Icons.available ? "󰅁 " : "‹ ") + "Your computer" - color: Theme.text - font.pixelSize: 13 - font.weight: Font.DemiBold - } - MouseArea { - id: backArea - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: ShellState.notchView = "main" - } + } + Rectangle { + objectName: detailView.view === "computer" ? "notchBack" : "notchBack-" + detailView.view + width: backLabel.implicitWidth + 28 + height: 30 + radius: 15 + color: backArea.containsMouse ? Theme.hover : Theme.fill + border.width: 1 + border.color: Theme.hairline + Text { + id: backLabel + anchors.centerIn: parent + text: (Icons.available ? "󰅁 " : "‹ ") + detailView.title + color: Theme.text + font.pixelSize: 13 + font.weight: Font.DemiBold } - Loader { - id: computerLoader - y: 44 - anchors.horizontalCenter: parent.horizontalCenter - active: ShellState.notchOpen && root.computer - source: DashboardRegistry.entry("performance").source - onLoaded: item.current = Qt.binding(() => ShellState.notchOpen && root.computer) + MouseArea { + id: backArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: ShellState.notchView = "main" } } + Loader { + id: detailLoader + y: 44 + anchors.horizontalCenter: parent.horizontalCenter + active: ShellState.notchOpen && detailView.shown + onLoaded: if ("current" in item) + item.current = Qt.binding(() => ShellState.notchOpen && detailView.shown) + } } IpcHandler { @@ -1082,7 +1109,14 @@ PanelWindow { return ShellState.toggleNotchMode(); } function view(name: string): void { - ShellState.notchView = name === "computer" ? "computer" : "main"; + ShellState.notchView = name === "computer" || name === "equalizer" ? name : "main"; + } + // Open straight onto a full view; again on that view closes the notch. + function computer(): void { + ShellState.toggleNotchView("computer"); + } + function equalizer(): void { + ShellState.toggleNotchView("equalizer"); } function status(): string { return JSON.stringify({ diff --git a/quickshell/notch/NotchMedia.qml b/quickshell/notch/NotchMedia.qml index 6d762a8..9996c93 100644 --- a/quickshell/notch/NotchMedia.qml +++ b/quickshell/notch/NotchMedia.qml @@ -2,12 +2,14 @@ pragma ComponentBehavior: Bound import QtQuick import Quickshell.Widgets import "../components" +import "../core" import "../dashboard" import "../services" import "../theme" // The notch's Media page: large artwork, track, seek bar, transport and a -// Cava strip, sized to fill the left column. +// Cava strip, sized to fill the left column. Clicking the artwork opens the +// equalizer view (when the dashboard's EasyEffects equalizer is on). Item { id: root property bool active: false @@ -15,6 +17,7 @@ Item { readonly property bool live: MediaService.length <= 0 || MediaService.length > 7 * 86400 readonly property bool hasPlayer: !!MediaService.player readonly property real artSize: Math.max(120, Math.min(width - 40, height - 250, 250)) + readonly property bool equalizer: ConfigService.ready && !!ConfigService.data.dashboard && ConfigService.data.dashboard.easyEffects Demand { service: MediaService counter: "progressConsumers" @@ -60,6 +63,35 @@ Item { } } } + // Hover hint for the equalizer. + Rectangle { + anchors.fill: parent + color: Qt.alpha("black", 0.45) + opacity: artArea.containsMouse ? 1 : 0 + Behavior on opacity { + NumberAnimation { + duration: Theme.notchDuration / 2 + } + } + Text { + anchors.centerIn: parent + text: "Equalizer" + color: "white" + font.pixelSize: 15 + font.weight: Font.DemiBold + } + } + MouseArea { + id: artArea + objectName: "notchArtwork" + anchors.fill: parent + enabled: root.equalizer + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: ShellState.notchView = "equalizer" + Accessible.role: Accessible.Button + Accessible.name: "Equalizer" + } } Column { width: parent.width diff --git a/scripts/glassmxrph b/scripts/glassmxrph index c0ff57a..ab9f121 100755 --- a/scripts/glassmxrph +++ b/scripts/glassmxrph @@ -51,7 +51,8 @@ case "${1:-run}" in exec quickshell ipc --path "$project_dir/quickshell" call dashboard toggle "${2:-}" ;; notch) - # glassmxrph notch [toggle|open|close|mode]; mode swaps notch mode and the full bar + # glassmxrph notch [toggle|open|close|mode|computer|equalizer]; mode swaps notch mode and the full bar, + # computer/equalizer open the notch straight onto that view (or the dashboard tab with the full bar) action=${2:-toggle} [ "$action" = mode ] && action=toggleMode exec quickshell ipc --path "$project_dir/quickshell" call notch "$action" @@ -79,5 +80,5 @@ case "${1:-run}" in settings|close|status) exec quickshell ipc --path "$project_dir/quickshell" call shell "$1" ;; - *) echo 'Usage: glassmxrph [run|wallpaper|launcher|overview|clipboard|emoji|dashboard [TAB]|notch [toggle|mode]|plugin ACTION|controlcenter|lock|widgets|osd ACTION|notifications ACTION|settings|close|status|doctor]' >&2; exit 2 ;; + *) echo 'Usage: glassmxrph [run|wallpaper|launcher|overview|clipboard|emoji|dashboard [TAB]|notch [toggle|mode|computer|equalizer]|plugin ACTION|controlcenter|lock|widgets|osd ACTION|notifications ACTION|settings|close|status|doctor]' >&2; exit 2 ;; esac