diff --git a/quickshell/bar/Bar.qml b/quickshell/bar/Bar.qml index baf69ef..5af60a5 100644 --- a/quickshell/bar/Bar.qml +++ b/quickshell/bar/Bar.qml @@ -112,6 +112,6 @@ PanelWindow { width: implicitWidth height: implicitHeight // The open notch window draws over this spot on its own screen. - visible: root.notch && !(ShellState.notchWindow && ShellState.notchWindow.visible && ShellState.notchWindow.screen === root.screen) && !(ShellState.launcherOpen && ScreenService.current(ShellState.launcherScreen) === root.screen) && !(ShellState.wallpaperWindow && ShellState.wallpaperWindow.visible && ShellState.wallpaperWindow.screen === root.screen) + visible: root.notch && !(ShellState.notchWindow && ShellState.notchWindow.visible && ShellState.notchWindow.screen === root.screen) && !(ShellState.launcherWindow && ShellState.launcherWindow.visible && ShellState.launcherWindow.screen === root.screen) && !(ShellState.wallpaperWindow && ShellState.wallpaperWindow.visible && ShellState.wallpaperWindow.screen === root.screen) } } diff --git a/quickshell/core/ShellState.qml b/quickshell/core/ShellState.qml index d2e3f2c..c0683b3 100644 --- a/quickshell/core/ShellState.qml +++ b/quickshell/core/ShellState.qml @@ -71,6 +71,7 @@ Singleton { readonly property real notchPillWidth: MediaService.playing ? 236 : 128 property var notchScreen: null property var notchWindow: null + property var launcherWindow: null // "main" is the three-column panel; "computer" is the full Performance view. property string notchView: "main" function openNotch() { diff --git a/quickshell/launcher/Launcher.qml b/quickshell/launcher/Launcher.qml index e5a960d..b10ab51 100644 --- a/quickshell/launcher/Launcher.qml +++ b/quickshell/launcher/Launcher.qml @@ -8,6 +8,7 @@ import "../components" import "../services" import "../theme" import "../core" +import "../notch" // Spotlight-style launcher: opens as a single search bar in the upper third. // Typing shows ranked results below it; the magnifying glass (or ↓ in an @@ -28,7 +29,7 @@ PanelWindow { left: true right: true } - visible: ShellState.launcherOpen || panel.opacity > 0.01 + visible: ShellState.launcherOpen || panel.opacity > 0.01 || (notch && progress > 0.001) color: Theme.transparent exclusionMode: ExclusionMode.Ignore WlrLayershell.namespace: "glassMxrph-launcher" @@ -79,6 +80,36 @@ PanelWindow { // Notch mode: the launcher drops out of the notch at the top edge. The // panel's top corners sit above the screen and concave ears join it there. readonly property bool notch: ShellState.notchMode + // Notch mode morphs the collapsed notch into the launcher, as the notch + // panel does: solid shape throughout, width leading the height a little, + // contents fading in once it is mostly open and out first. + property real progress: ShellState.launcherOpen ? 1 : 0 + Behavior on progress { + enabled: root.notch + NumberAnimation { + id: morph + duration: ShellState.launcherOpen ? Theme.notchOpenDuration * 2 : Theme.notchCloseDuration * 1.3 + easing.type: Easing.BezierSpline + easing.bezierCurve: ShellState.launcherOpen ? [0.2, 0, 0, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1] + } + } + readonly property bool settled: ShellState.launcherOpen && !morph.running + readonly property real wp: Math.min(1, progress * 1.15) + readonly property real contentOpacity: Math.max(0, Math.min(1, (progress - 0.55) / 0.4)) + // Open height, held while closing so clearing the results does not jump it. + property real heldHeight: barHeight + bodyHeight + Binding on heldHeight { + when: ShellState.launcherOpen + value: root.barHeight + root.bodyHeight + restoreMode: Binding.RestoreNone + } + Behavior on heldHeight { + enabled: root.notch && root.settled && !root.snapping + NumberAnimation { + duration: Theme.duration + easing.type: Easing.OutCubic + } + } // Pills sit inside the search bar in notch mode, smaller. readonly property int notchPill: 36 readonly property real maxBodyHeight: Math.min(460, root.height * 0.78 - barHeight - (notch ? 0 : root.height * 0.22)) @@ -146,8 +177,14 @@ PanelWindow { selectedIndex = 0; search.forceActiveFocus(); } - Component.onCompleted: LauncherState.window = root - Component.onDestruction: LauncherState.window = null + Component.onCompleted: { + LauncherState.window = root; + ShellState.launcherWindow = root; + } + Component.onDestruction: { + LauncherState.window = null; + ShellState.launcherWindow = null; + } Connections { target: ShellState function onLauncherOpenChanged() { @@ -270,7 +307,6 @@ PanelWindow { visible: root.notch x: panel.x - BarDrawers.ear y: 0 - opacity: panel.opacity bodyWidth: panel.width bodyHeight: panel.height ear: BarDrawers.ear @@ -283,42 +319,53 @@ PanelWindow { } } } + // The collapsed notch's time and media, fading out as the launcher grows + // out of it and back in as it shrinks home. + NotchGlance { + visible: root.notch && opacity > 0 + x: Math.round((root.width - width) / 2) + y: Math.round((BarDrawers.bottom - height) / 2) + opacity: Math.max(0, 1 - root.progress / 0.3) + } GlassPanel { id: panel objectName: "launcherSurface" x: Math.round((root.width - width) / 2) y: root.notch ? 0 : Math.round(root.height * 0.22) // Notch mode grows out of the collapsed notch and shrinks back into it. - width: ShellState.launcherOpen ? root.targetWidth : root.notch ? ShellState.notchPillWidth : Math.min(320, root.targetWidth) - height: root.notch && !ShellState.launcherOpen ? BarDrawers.bottom : root.barHeight + root.bodyHeight + width: root.notch ? ShellState.notchPillWidth + (root.targetWidth - ShellState.notchPillWidth) * root.wp : ShellState.launcherOpen ? root.targetWidth : Math.min(320, root.targetWidth) + height: root.notch ? BarDrawers.bottom + (root.heldHeight - BarDrawers.bottom) * root.progress : root.barHeight + root.bodyHeight color: root.notch ? Theme.transparent : Qt.alpha(Theme.surface, surfaceOpacity) border.width: root.notch ? 0 : 1 plain: root.notch radius: Math.min(Theme.radius + 6, root.barHeight / 2) - opacity: ShellState.launcherOpen ? 1 : 0 + opacity: root.notch ? root.contentOpacity : ShellState.launcherOpen ? 1 : 0 scale: ShellState.launcherOpen || root.notch ? 1 : 1 - 0.04 * Theme.intensity clip: true Behavior on width { + enabled: !root.notch NumberAnimation { - duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration + duration: Theme.duration easing.type: Easing.OutCubic } } Behavior on height { - enabled: !root.snapping + enabled: !root.notch && !root.snapping NumberAnimation { - duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration + duration: Theme.duration easing.type: Easing.OutCubic } } Behavior on opacity { + enabled: !root.notch NumberAnimation { - duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration + duration: Theme.duration } } Behavior on scale { + enabled: !root.notch NumberAnimation { - duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration + duration: Theme.duration easing.type: Easing.OutCubic } } diff --git a/quickshell/notch/NotchGlance.qml b/quickshell/notch/NotchGlance.qml new file mode 100644 index 0000000..b3728d4 --- /dev/null +++ b/quickshell/notch/NotchGlance.qml @@ -0,0 +1,63 @@ +pragma ComponentBehavior: Bound +import QtQuick +import Quickshell +import Quickshell.Widgets +import "../services" +import "../theme" + +// What the collapsed notch shows: the time, plus cover art and a small +// visualizer while audio plays. Shared by the pill and by the launcher, which +// fades it out as it grows out of the notch. +Row { + id: root + property bool playing: MediaService.playing + spacing: 10 + ClippingRectangle { + visible: root.playing + anchors.verticalCenter: parent.verticalCenter + width: 22 + height: 22 + radius: 6 + color: Theme.fill + Image { + anchors.fill: parent + source: MediaService.artwork + sourceSize: Qt.size(44, 44) + fillMode: Image.PreserveAspectCrop + asynchronous: true + } + } + Text { + anchors.verticalCenter: parent.verticalCenter + text: Qt.formatDateTime(clock.date, ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm") + color: Theme.text + font.pixelSize: 14 + font.weight: Font.DemiBold + font.features: { + "tnum": 1 + } + } + Row { + visible: root.playing + anchors.verticalCenter: parent.verticalCenter + height: 16 + spacing: 2 + Repeater { + model: 8 + Rectangle { + required property int index + // Every third Cava band, so the eight span the spectrum. + readonly property real level: CavaService.bars[index * 3] || 0 + width: 3 + height: Math.max(3, 16 * level) + y: 16 - height + radius: 1.5 + color: Theme.accent + } + } + } + SystemClock { + id: clock + precision: SystemClock.Minutes + } +} diff --git a/quickshell/notch/NotchPill.qml b/quickshell/notch/NotchPill.qml index 613da9f..9395aaa 100644 --- a/quickshell/notch/NotchPill.qml +++ b/quickshell/notch/NotchPill.qml @@ -1,7 +1,5 @@ pragma ComponentBehavior: Bound import QtQuick -import Quickshell -import Quickshell.Widgets import "../components" import "../core" import "../services" @@ -40,10 +38,6 @@ Item { easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } } - SystemClock { - id: clock - precision: SystemClock.Minutes - } Demand { service: CavaService counter: "widgetConsumers" @@ -63,54 +57,9 @@ Item { width: ShellState.notchPillWidth height: root.height } - Row { - id: content + NotchGlance { anchors.centerIn: lead - spacing: 10 - ClippingRectangle { - visible: root.playing - anchors.verticalCenter: parent.verticalCenter - width: 22 - height: 22 - radius: 6 - color: Theme.fill - Image { - anchors.fill: parent - source: MediaService.artwork - sourceSize: Qt.size(44, 44) - fillMode: Image.PreserveAspectCrop - asynchronous: true - } - } - Text { - anchors.verticalCenter: parent.verticalCenter - text: Qt.formatDateTime(clock.date, ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm") - color: Theme.text - font.pixelSize: 14 - font.weight: Font.DemiBold - font.features: { - "tnum": 1 - } - } - Row { - visible: root.playing - anchors.verticalCenter: parent.verticalCenter - height: 16 - spacing: 2 - Repeater { - model: 8 - Rectangle { - required property int index - // Every third Cava band, so the eight span the spectrum. - readonly property real level: CavaService.bars[index * 3] || 0 - width: 3 - height: Math.max(3, 16 * level) - y: 16 - height - radius: 1.5 - color: Theme.accent - } - } - } + playing: root.playing } MouseArea { anchors.fill: parent