From 5217af4f672ba9af3fda7edf458b0b72f2150903 Mon Sep 17 00:00:00 2001 From: mx Date: Thu, 12 Nov 2026 16:39:35 +0100 Subject: [PATCH] Add a notch mode that splits the bar around a pocket-dots style notch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings → Notch switches it on. The bar becomes left and right islands with a notch at the top centre. Super+C, Super+X and a click on the notch open a three-column panel: dashboard pages on the left (Media, Performance, Calendar; the wheel switches them), the Control Center tiles and weather in the middle, and notifications on the right. The Performance card opens the full "Your computer" view. The launcher drops out of the notch. Co-Authored-By: Claude Opus 5.5 --- quickshell/bar/Bar.qml | 46 +- quickshell/config/defaults.json | 4 + quickshell/core/SettingsRegistry.qml | 11 + quickshell/core/ShellState.qml | 45 +- quickshell/dock/DockState.qml | 1 + quickshell/launcher/Launcher.qml | 51 +- quickshell/lock/LockState.qml | 1 + quickshell/notch/Notch.qml | 592 ++++++++++++++++++ quickshell/notch/NotchPill.qml | 111 ++++ .../notifications/NotificationPopups.qml | 7 +- quickshell/osd/Osd.qml | 2 +- quickshell/services/ConfigLogic.js | 1 + quickshell/services/PluginService.qml | 1 + quickshell/services/PowerService.qml | 4 + quickshell/services/SystemService.qml | 2 +- quickshell/services/TrayService.qml | 1 + quickshell/settings/Settings.qml | 6 + quickshell/settings/pages/Notch.qml | 43 ++ quickshell/shell.qml | 3 + quickshell/widgets/WidgetState.qml | 1 + 20 files changed, 919 insertions(+), 14 deletions(-) create mode 100644 quickshell/notch/Notch.qml create mode 100644 quickshell/notch/NotchPill.qml create mode 100644 quickshell/settings/pages/Notch.qml diff --git a/quickshell/bar/Bar.qml b/quickshell/bar/Bar.qml index dcb87f2..7803f94 100644 --- a/quickshell/bar/Bar.qml +++ b/quickshell/bar/Bar.qml @@ -3,6 +3,7 @@ import QtQuick.Shapes import Quickshell import Quickshell.Wayland import "../components" +import "../notch" import "../core" import "../services" import "../theme" @@ -18,7 +19,14 @@ PanelWindow { // The window reaches below the bar (input is masked to the bar) so the // HyprGlass layer edge is not on the bar's bottom edge, where drawers join. implicitHeight: BarDrawers.bottom + BarDrawers.overhang - mask: Region { item: panel } + // Notch mode splits the bar into a left island, the centre notch and a + // right island; only those take input. + readonly property bool notch: ShellState.notchMode + mask: Region { + item: root.notch ? leftIsland : panel + Region { item: root.notch ? notchPill : null; intersection: Intersection.Combine } + Region { item: root.notch ? rightIsland : null; intersection: Intersection.Combine } + } color: Theme.transparent // Reserve the bar itself (margin + height), not the overhang below it, so // windows tile beneath the bar instead of under it. @@ -29,18 +37,21 @@ PanelWindow { Component.onDestruction: TrayService.unregisterBar(root) GlassPanel { id: panel + visible: !root.notch x: root.outerMargin; y: root.outerMargin width: root.width - 2 * root.outerMargin height: BarDrawers.height radius: BarDrawers.radius border.width: 0 - ModuleRow { position: "left"; barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter } + // In notch mode the side rows move into their islands; the notch replaces the centre. + ModuleRow { id: leftRow; parent: root.notch ? leftIsland : panel; position: "left"; barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter } ModuleRow { position: "center"; barScreen: root.screen; anchors.centerIn: parent } - ModuleRow { position: "right"; barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter } + ModuleRow { id: rightRow; parent: root.notch ? rightIsland : panel; position: "right"; barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter } } // Outline with openings where drawers hang from the bar. Shape { id: outline + visible: !root.notch x: panel.x y: panel.y width: panel.width @@ -63,4 +74,33 @@ PanelWindow { } } } + // Notch mode ------------------------------------------------------------- + GlassPanel { + id: leftIsland + visible: root.notch + x: root.outerMargin + y: root.outerMargin + width: leftRow.implicitWidth + 12 + height: BarDrawers.height + radius: BarDrawers.radius + } + GlassPanel { + id: rightIsland + visible: root.notch + x: root.width - root.outerMargin - width + y: root.outerMargin + width: rightRow.implicitWidth + 12 + height: BarDrawers.height + radius: BarDrawers.radius + } + NotchPill { + id: notchPill + barScreen: root.screen + x: Math.round((root.width - width) / 2) + y: 0 + 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) + } } diff --git a/quickshell/config/defaults.json b/quickshell/config/defaults.json index 4f49155..f9d7fb6 100644 --- a/quickshell/config/defaults.json +++ b/quickshell/config/defaults.json @@ -262,6 +262,10 @@ }, "effectEnabled": true }, + "notch": { + "enabled": false, + "mediaFirst": true + }, "dashboard": { "enabled": true, "position": "top-center", diff --git a/quickshell/core/SettingsRegistry.qml b/quickshell/core/SettingsRegistry.qml index 93ca55f..b2d1b93 100644 --- a/quickshell/core/SettingsRegistry.qml +++ b/quickshell/core/SettingsRegistry.qml @@ -70,6 +70,17 @@ Singleton { icon: "󰕮", keywords: ["Bar height", "Margin", "Modules", "Show date", "24-hour time", "Show seconds", "Workspace count", "Workspace style", "Pacman", "Roman numerals", "Clock"] }, + { + id: "notch", + title: "Notch", + command: "notch", + description: "Notch mode: side islands and a pocket-dots style notch instead of the bar", + phase: 9, + available: true, + group: "shell", + icon: "󰹑", + keywords: ["Notch", "Notch mode", "Open on Media while audio plays", "Pocket-dots", "Island"] + }, { id: "tray", title: "Bar / Tray", diff --git a/quickshell/core/ShellState.qml b/quickshell/core/ShellState.qml index a6e3114..6e91e9e 100644 --- a/quickshell/core/ShellState.qml +++ b/quickshell/core/ShellState.qml @@ -1,13 +1,14 @@ pragma Singleton import QtQuick import Quickshell +import "../services" Singleton { property bool wallpaperPickerOpen: false property var wallpaperScreen: null property var wallpaperWindow: null function openWallpaperPicker() { - settingsOpen=false;launcherOpen=false;controlCenterOpen=false;dashboardOpen=false;overviewOpen=false; + settingsOpen=false;launcherOpen=false;controlCenterOpen=false;dashboardOpen=false;overviewOpen=false;notchOpen=false; wallpaperScreen=activeScreen();wallpaperPickerOpen=true; } property var systemPills: [] @@ -15,6 +16,8 @@ Singleton { property var controlCenterScreen: null property var controlCenterWindow: null function openControlCenter() { + if (notchMode) + return openNotch(); wallpaperPickerOpen=false; overviewOpen = false; dashboardOpen = false; @@ -26,6 +29,8 @@ Singleton { controlCenterOpen = true; } function toggleControlCenter() { + if (notchMode) + return toggleNotch(); if (controlCenterOpen) controlCenterOpen = false; else @@ -37,6 +42,8 @@ Singleton { property var dashboardWindow: null property string dashboardTab: "" function openDashboard(tab) { + if (notchMode) + return openNotch(); wallpaperPickerOpen = false; overviewOpen = false; controlCenterOpen = false; @@ -49,17 +56,51 @@ Singleton { dashboardOpen = true; } function toggleDashboard(tab) { + if (notchMode) + return toggleNotch(); if (dashboardOpen && (!tab || tab === dashboardTab)) dashboardOpen = false; else openDashboard(tab); } + // Notch mode (pocket-dots style): the bar splits into side islands and a + // centre notch; the Control Center and Dashboard keys open the notch instead. + readonly property bool notchMode: ConfigService.ready && !!ConfigService.data.notch && ConfigService.data.notch.enabled + property bool notchOpen: false + // Collapsed notch body width (ears excluded): clock alone, or art + clock + cava. + readonly property real notchPillWidth: MediaService.playing ? 236 : 128 + property var notchScreen: null + property var notchWindow: null + // "main" is the three-column panel; "computer" is the full Performance view. + property string notchView: "main" + function openNotch() { + wallpaperPickerOpen = false; + overviewOpen = false; + controlCenterOpen = false; + dashboardOpen = false; + launcherOpen = false; + settingsOpen = false; + if (!notchOpen) { + notchScreen = activeScreen(); + notchView = "main"; + } + notchOpen = true; + } + function toggleNotch() { + if (notchOpen) + notchOpen = false; + else + openNotch(); + } + onNotchModeChanged: if (!notchMode) + notchOpen = false // Workspace overview (SUPER+Tab): a drawer of live workspace thumbnails. property bool overviewOpen: false property var overviewScreen: null property var overviewWindow: null function openOverview() { wallpaperPickerOpen = false; + notchOpen = false; controlCenterOpen = false; dashboardOpen = false; launcherOpen = false; @@ -85,6 +126,7 @@ Singleton { } function openLauncher(mode) { wallpaperPickerOpen=false; + notchOpen = false; overviewOpen = false; dashboardOpen = false; launcherMode = mode === "clipboard" || mode === "emoji" ? mode : "apps"; @@ -130,6 +172,7 @@ Singleton { } function openSettings(page) { wallpaperPickerOpen=false; + notchOpen = false; overviewOpen = false; dashboardOpen = false; controlCenterOpen = false; diff --git a/quickshell/dock/DockState.qml b/quickshell/dock/DockState.qml index 3c3ab9e..42e5805 100644 --- a/quickshell/dock/DockState.qml +++ b/quickshell/dock/DockState.qml @@ -23,6 +23,7 @@ Singleton { return; TrayService.close(); ShellState.controlCenterOpen = false; + ShellState.notchOpen = false; ShellState.launcherOpen = false; ShellState.settingsOpen = false; appId = id; diff --git a/quickshell/launcher/Launcher.qml b/quickshell/launcher/Launcher.qml index 9f43497..fb70e85 100644 --- a/quickshell/launcher/Launcher.qml +++ b/quickshell/launcher/Launcher.qml @@ -2,6 +2,7 @@ pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import QtQuick.Layouts +import QtQuick.Shapes import Quickshell import Quickshell.Wayland import "../components" @@ -76,7 +77,11 @@ PanelWindow { // A hovered mode pill names itself in the empty search bar. property string pillHover: "" readonly property int barHeight: 60 - readonly property real maxBodyHeight: Math.min(460, root.height * 0.78 - barHeight - (root.height * 0.22)) + // 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 + readonly property real notchInset: notch ? panel.radius : 0 + readonly property real maxBodyHeight: Math.min(460, root.height * 0.78 - barHeight - (notch ? 0 : root.height * 0.22)) // Clipboard mode shows the latest five rows; the rest scroll. readonly property real clipboardRows: 5 * 48 - 2 // Emoji mode shows six rows of the grid; the rest scroll. @@ -193,7 +198,7 @@ PanelWindow { id: pills objectName: "launcherPills" x: panel.x + panel.width + 10 - y: panel.y + (root.barHeight - root.pillSize) / 2 + y: panel.y + root.notchInset + (root.barHeight - root.pillSize) / 2 spacing: 10 opacity: panel.opacity scale: panel.scale @@ -256,16 +261,47 @@ PanelWindow { } } } + // Notch ears: concave fillets joining the panel to the screen's top edge. + Repeater { + model: root.notch ? [0, 1] : [] + Shape { + id: earShape + required property int modelData + readonly property real e: BarDrawers.ear + x: modelData === 0 ? panel.x - e : panel.x + panel.width + y: 0 + width: e + height: e + opacity: panel.opacity + preferredRendererType: Shape.CurveRenderer + ShapePath { + fillColor: panel.color + strokeColor: "transparent" + strokeWidth: 0 + PathSvg { + path: earShape.modelData === 0 ? `M 0 0 L ${earShape.e} 0 L ${earShape.e} ${earShape.e} A ${earShape.e} ${earShape.e} 0 0 0 0 0 Z` : `M 0 0 L ${earShape.e} 0 A ${earShape.e} ${earShape.e} 0 0 0 0 ${earShape.e} Z` + } + } + ShapePath { + fillColor: "transparent" + strokeColor: panel.border.color + strokeWidth: 1 + PathSvg { + path: earShape.modelData === 0 ? `M 0 0.5 A ${earShape.e} ${earShape.e} 0 0 1 ${earShape.e - 0.5} ${earShape.e}` : `M 0.5 ${earShape.e} A ${earShape.e} ${earShape.e} 0 0 1 ${earShape.e} 0.5` + } + } + } + } GlassPanel { id: panel objectName: "launcherSurface" x: Math.round((root.width - width) / 2) - y: Math.round(root.height * 0.22) - width: ShellState.launcherOpen ? root.targetWidth : Math.min(320, root.targetWidth) - height: root.barHeight + root.bodyHeight + y: root.notch ? -root.notchInset : Math.round(root.height * 0.22) + width: ShellState.launcherOpen ? root.targetWidth : root.notch ? ShellState.notchPillWidth : Math.min(320, root.targetWidth) + height: root.barHeight + root.bodyHeight + root.notchInset radius: Math.min(Theme.radius + 6, root.barHeight / 2) opacity: ShellState.launcherOpen ? 1 : 0 - scale: ShellState.launcherOpen ? 1 : 1 - 0.04 * Theme.intensity + scale: ShellState.launcherOpen || root.notch ? 1 : 1 - 0.04 * Theme.intensity clip: true Behavior on width { NumberAnimation { @@ -301,6 +337,7 @@ PanelWindow { anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top + anchors.topMargin: root.notchInset height: root.barHeight anchors.leftMargin: 12 anchors.rightMargin: 18 @@ -401,7 +438,7 @@ PanelWindow { anchors.right: parent.right anchors.top: bar.bottom anchors.bottom: parent.bottom - visible: root.bodyHeight > 0 || panel.height > root.barHeight + 1 + visible: root.bodyHeight > 0 || panel.height > root.barHeight + root.notchInset + 1 Rectangle { anchors.left: parent.left anchors.right: parent.right diff --git a/quickshell/lock/LockState.qml b/quickshell/lock/LockState.qml index 276f12f..6671adb 100644 --- a/quickshell/lock/LockState.qml +++ b/quickshell/lock/LockState.qml @@ -74,6 +74,7 @@ Singleton { previewing = false; ShellState.settingsOpen = false; ShellState.controlCenterOpen = false; + ShellState.notchOpen = false; ShellState.launcherOpen = false; primary = mainScreen(); status = ""; diff --git a/quickshell/notch/Notch.qml b/quickshell/notch/Notch.qml new file mode 100644 index 0000000..0c0486e --- /dev/null +++ b/quickshell/notch/Notch.qml @@ -0,0 +1,592 @@ +pragma ComponentBehavior: Bound +import QtQuick +import QtQuick.Controls +import Quickshell +import Quickshell.Io +import Quickshell.Wayland +import "../components" +import "../controlcenter" +import "../controlcenter/GridLogic.js" as Grid +import "../core" +import "../dashboard" +import "../media" +import "../services" +import "../theme" +import "../widgets/faces" as Faces + +// Notch mode's open panel (pocket-dots style). It grows out of the collapsed +// 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. +// The layer is sized to the shape so HyprGlass follows its outline. +// qmllint disable uncreatable-type +PanelWindow { + // qmllint enable uncreatable-type + id: root + screen: ScreenService.current(ShellState.notchScreen) + readonly property real screenWidth: screen ? screen.width : 1920 + 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 real ear: BarDrawers.ear + readonly property real band: BarDrawers.bottom + readonly property int pad: 22 + readonly property int sideWidth: 330 + readonly property int middleWidth: 440 + readonly property int columnGap: 44 + + // 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(440, middle.contentHeight + band + 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) + property real progress: ShellState.notchOpen ? 1 : 0 + Behavior on progress { + NumberAnimation { + id: morph + duration: ShellState.notchOpen ? Theme.duration * 2 : Theme.duration * 1.3 + easing.type: Easing.BezierSpline + easing.bezierCurve: ShellState.notchOpen ? [0.2, 0, 0, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1] + } + } + readonly property bool settled: ShellState.notchOpen && !morph.running + // Width leads the height a little, like a notch unfolding. + readonly property real wp: Math.min(1, progress * 1.15) + property real targetWidth: openWidth + property real targetHeight: openHeight + Behavior on targetWidth { + enabled: root.settled + NumberAnimation { + duration: Theme.duration * 1.4 + easing.type: Easing.BezierSpline + easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] + } + } + Behavior on targetHeight { + enabled: root.settled + NumberAnimation { + duration: Theme.duration * 1.4 + easing.type: Easing.BezierSpline + easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] + } + } + readonly property real bodyWidth: ShellState.notchPillWidth + (targetWidth - ShellState.notchPillWidth) * wp + readonly property real bodyHeight: band + (targetHeight - band) * progress + // Content fades in once the shape has mostly opened, and out first. + readonly property real contentOpacity: Math.max(0, Math.min(1, (progress - 0.55) / 0.4)) + + anchors.top: true + implicitWidth: Math.round(bodyWidth + 2 * ear) + implicitHeight: Math.max(1, Math.round(bodyHeight)) + visible: ShellState.notchOpen || progress > 0.001 + color: Theme.transparent + exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Overlay + // Shares the dashboard's HyprGlass namespace (already whitelisted). + WlrLayershell.namespace: "glassMxrph-dashboard" + WlrLayershell.keyboardFocus: ShellState.notchOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None + Component.onCompleted: ShellState.notchWindow = root + Component.onDestruction: ShellState.notchWindow = null + + // Opening with audio playing always lands on Media. + Connections { + target: ShellState + function onNotchOpenChanged() { + if (ShellState.notchOpen) { + if (MediaService.playing && (!root.options || root.options.mediaFirst)) + pager.page = 0; + body.forceActiveFocus(); + } + } + } + + // Exclusive focus routes outside clicks here (see ControlCenter). + MouseArea { + objectName: "notchOutside" + x: -20000 + y: -20000 + width: 40000 + height: 40000 + onPressed: ShellState.notchOpen = false + } + + DrawerShape { + bodyWidth: root.bodyWidth + bodyHeight: root.bodyHeight + ear: root.ear + radius: Math.min(Theme.radius + 8, root.bodyHeight / 2) + } + + Item { + id: body + objectName: "notchSurface" + x: root.ear + width: root.bodyWidth + height: root.bodyHeight + clip: true + focus: ShellState.notchOpen + Keys.onEscapePressed: { + if (root.computer) + ShellState.notchView = "main"; + else + ShellState.notchOpen = false; + } + Keys.onUpPressed: pager.go(pager.page - 1) + Keys.onDownPressed: pager.go(pager.page + 1) + MouseArea { + anchors.fill: parent + } // Inside clicks must not dismiss. + + // The clock stays put in the band while the notch opens around it. + SystemClock { + id: clock + precision: SystemClock.Minutes + } + Row { + anchors.horizontalCenter: parent.horizontalCenter + y: (root.band - height) / 2 + spacing: 8 + Text { + 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 + } + } + Text { + opacity: root.contentOpacity + text: "· " + Qt.formatDateTime(clock.date, "ddd d MMMM") + color: Theme.textSecondary + font.pixelSize: 14 + } + } + + // Main view ---------------------------------------------------------- + Item { + id: main + x: (root.bodyWidth - root.mainWidth) / 2 + root.pad + y: root.band + width: root.mainWidth - 2 * root.pad + height: root.targetHeight - root.band - root.pad + visible: opacity > 0 + opacity: root.computer ? 0 : root.contentOpacity + Behavior on opacity { + enabled: root.settled + NumberAnimation { + duration: Theme.duration + } + } + + // Left: dashboard pager. + Item { + id: pager + objectName: "notchPager" + width: root.sideWidth + height: parent.height + clip: true + property int page: 0 + readonly property int count: 3 + function go(i) { + page = Math.max(0, Math.min(count - 1, i)); + } + property real wheelAccum: 0 + Timer { + id: wheelLock + interval: 320 + } + Column { + y: -pager.page * pager.height + Behavior on y { + NumberAnimation { + duration: Theme.duration * 1.6 + easing.type: Easing.BezierSpline + easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] + } + } + // Media + Item { + width: pager.width + height: pager.height + MediaCard { + anchors.centerIn: parent + width: parent.width - 20 + compact: true + color: Theme.transparent + border.width: 0 + } + } + // Performance: click for the full view. + Item { + id: perf + width: pager.width + height: pager.height + readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({}) + Demand { + service: MetricsService + active: ShellState.notchOpen && pager.page === 1 + } + Rectangle { + anchors.centerIn: parent + width: parent.width - 20 + height: perfColumn.implicitHeight + 36 + radius: Math.max(12, Theme.radius * 0.75) + color: perfArea.containsMouse ? Theme.hover : Theme.surfaceVariant + border.width: 1 + border.color: Theme.hairline + Behavior on color { + ColorAnimation { + duration: Theme.duration / 2 + } + } + Column { + id: perfColumn + anchors.centerIn: parent + width: parent.width - 36 + spacing: 18 + Item { + width: parent.width + height: 22 + Text { + text: "Your computer" + color: Theme.text + font.pixelSize: 15 + font.weight: Font.DemiBold + } + Text { + anchors.right: parent.right + text: Icons.available ? "󰅂" : "›" + font.family: Icons.available ? Icons.family : "" + color: Theme.textSecondary + font.pixelSize: 18 + } + } + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 14 + Gauge { + size: 76 + value: MetricsService.cpu.percent + caption: "CPU" + } + Gauge { + size: 76 + value: MetricsService.ram.percent + caption: "Memory" + } + Gauge { + size: 76 + value: perf.disk.percent + caption: "Disk" + } + } + Text { + width: parent.width + horizontalAlignment: Text.AlignHCenter + readonly property var gpu: MetricsService.gpu || ({}) + text: Number.isFinite(gpu.percent) ? "GPU " + Math.round(gpu.percent) + "%" + (Number.isFinite(gpu.temperature) ? " · " + Math.round(gpu.temperature) + " °C" : "") : "Click for details" + color: Theme.textSecondary + font.pixelSize: 12 + } + } + MouseArea { + id: perfArea + objectName: "notchComputer" + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: ShellState.notchView = "computer" + } + } + } + // Calendar + Item { + width: pager.width + height: pager.height + Faces.CalendarFace { + anchors.centerIn: parent + width: parent.width - 20 + height: Math.min(parent.height, 300) + } + } + } + // Wheel moves one page per notch; touchpads are rate-limited. + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + onWheel: wheel => { + pager.wheelAccum += wheel.angleDelta.y; + if (Math.abs(pager.wheelAccum) < 120 || wheelLock.running) + return; + pager.go(pager.page + (pager.wheelAccum < 0 ? 1 : -1)); + pager.wheelAccum = 0; + wheelLock.restart(); + } + } + Column { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: 8 + Repeater { + model: pager.count + Rectangle { + required property int index + width: 6 + height: pager.page === index ? 20 : 6 + radius: 3 + color: pager.page === index ? Theme.accent : Qt.alpha(Theme.text, 0.25) + Behavior on height { + NumberAnimation { + duration: Theme.duration + easing.type: Easing.OutCubic + } + } + MouseArea { + anchors.fill: parent + anchors.margins: -4 + cursorShape: Qt.PointingHandCursor + onClicked: pager.go(parent.index) + } + } + } + } + } + Rectangle { + x: root.sideWidth + root.columnGap / 2 + width: 1 + height: parent.height + color: Theme.hairline + } + + // Middle: Control Center tiles (minus Now Playing, which is on the + // left) packed in their saved order, then the weather. + Flickable { + id: middle + x: root.sideWidth + root.columnGap + width: root.middleWidth + height: parent.height + contentWidth: width + contentHeight: middleColumn.implicitHeight + clip: true + boundsBehavior: Flickable.StopAtBounds + ScrollBar.vertical: ScrollBar { + policy: ScrollBar.AsNeeded + } + readonly property int gap: 10 + readonly property int cellHeight: 68 + readonly property real cellWidth: (width - 3 * gap) / Grid.COLS + readonly property var tiles: (ConfigService.ready ? ConfigService.data.controlCenter.modules : []).filter(m => m.enabled && m.id !== "media" && !!ControlRegistry.entry(m.id) && !ControlRegistry.entry(m.id).section).slice().sort((a, b) => ((Number.isInteger(a.y) ? a.y : 99) - (Number.isInteger(b.y) ? b.y : 99)) || ((Number.isInteger(a.x) ? a.x : 0) - (Number.isInteger(b.x) ? b.x : 0))) + readonly property var plan: Grid.layout(tiles.map(m => { + const size = ControlRegistry.size(m); + return { + id: m.id, + w: size.w, + h: size.h + }; + })) + property var extras: ({}) + function setExtra(id, value) { + if ((extras[id] || 0) === value) + return; + const next = Object.assign({}, extras); + next[id] = value; + extras = next; + } + readonly property var geometry: Grid.geometry(plan, cellWidth, cellHeight, gap, extras) + readonly property var weatherOptions: { + const items = ConfigService.ready ? ConfigService.data.desktopWidgets.items : []; + const w = items.find(i => i.type === "weather"); + return w && w.options ? w.options : {}; + } + Column { + id: middleColumn + width: middle.width + spacing: 14 + Item { + id: tileGrid + width: parent.width + height: middle.geometry.height + Repeater { + model: ScriptModel { + values: middle.tiles.map(m => m.id) + } + Item { + id: slot + required property string modelData + readonly property var cell: middle.plan.items.find(i => i.id === modelData) || null + readonly property var rect: middle.geometry.tiles[modelData] || null + readonly property real extra: loader.item ? loader.item.extraHeight : 0 + objectName: "notchTile-" + modelData + visible: !!rect + x: rect ? rect.x : 0 + y: rect ? rect.y : 0 + width: rect ? rect.w : 0 + height: rect ? rect.h : 0 + onExtraChanged: middle.setExtra(modelData, extra) + Behavior on y { + enabled: root.settled + NumberAnimation { + duration: Theme.duration + easing.type: Easing.OutCubic + } + } + Loader { + id: loader + anchors.fill: parent + active: ShellState.notchOpen + source: ControlRegistry.entry(slot.modelData).source + } + Binding { + target: loader.item + when: !!loader.item + property: "moduleId" + value: slot.modelData + } + Binding { + target: loader.item + when: !!loader.item && !!slot.cell + property: "cols" + value: slot.cell ? slot.cell.w : 1 + } + Binding { + target: loader.item + when: !!loader.item && !!slot.cell + property: "rows" + value: slot.cell ? slot.cell.h : 1 + } + Binding { + target: loader.item + when: !!loader.item && !!slot.cell + property: "baseHeight" + value: slot.cell ? slot.cell.h * middle.cellHeight + (slot.cell.h - 1) * middle.gap : 0 + } + } + } + } + Rectangle { + width: parent.width + height: 92 + radius: Math.min(30, height / 2) + color: Theme.fill + border.width: 1 + border.color: Theme.hairline + Faces.WeatherFace { + anchors.fill: parent + options: middle.weatherOptions + visible: ShellState.notchOpen + } + } + } + } + Rectangle { + x: root.sideWidth + root.columnGap + root.middleWidth + root.columnGap / 2 + width: 1 + height: parent.height + color: Theme.hairline + } + + // Right: notifications. + Flickable { + x: root.sideWidth + 2 * root.columnGap + root.middleWidth + width: root.sideWidth + height: parent.height + contentWidth: width + contentHeight: notifications.implicitHeight + clip: true + boundsBehavior: Flickable.StopAtBounds + Loader { + id: notifications + width: parent.width + active: ShellState.notchOpen + source: ControlRegistry.entry("notifications").source + } + } + } + + // "Your computer": the dashboard's Performance tab ------------------- + Item { + id: computerView + x: root.pad + y: root.band + width: root.bodyWidth - 2 * root.pad + height: root.bodyHeight - root.band - root.pad + visible: opacity > 0 + opacity: root.computer ? root.contentOpacity : 0 + Behavior on opacity { + enabled: root.settled + NumberAnimation { + duration: Theme.duration + } + } + 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" + } + } + 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) + } + } + } + + IpcHandler { + target: "notch" + function toggle(): void { + ShellState.toggleNotch(); + } + function open(): void { + ShellState.openNotch(); + } + function close(): void { + ShellState.notchOpen = false; + } + function page(index: int): void { + pager.go(index); + } + function view(name: string): void { + ShellState.notchView = name === "computer" ? "computer" : "main"; + } + function status(): string { + return JSON.stringify({ + mode: ShellState.notchMode, + open: ShellState.notchOpen, + visible: root.visible, + view: ShellState.notchView, + page: pager.page, + screen: root.screen ? root.screen.name : "", + width: root.implicitWidth, + height: root.implicitHeight + }); + } + } +} diff --git a/quickshell/notch/NotchPill.qml b/quickshell/notch/NotchPill.qml new file mode 100644 index 0000000..e1ae4cc --- /dev/null +++ b/quickshell/notch/NotchPill.qml @@ -0,0 +1,111 @@ +pragma ComponentBehavior: Bound +import QtQuick +import Quickshell +import Quickshell.Widgets +import "../components" +import "../core" +import "../services" +import "../theme" + +// The collapsed notch: a glass island hanging from the screen's top edge with +// concave ears, showing the time, plus cover art and a small visualizer while +// audio plays. Clicking it opens the notch panel. +Item { + id: root + property var barScreen + readonly property real bodyWidth: ShellState.notchPillWidth + readonly property bool playing: MediaService.playing + implicitWidth: bodyWidth + 2 * BarDrawers.ear + implicitHeight: BarDrawers.bottom + Behavior on implicitWidth { + NumberAnimation { + duration: Theme.duration * 1.6 + easing.type: Easing.BezierSpline + easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] + } + } + SystemClock { + id: clock + precision: SystemClock.Minutes + } + Demand { + service: CavaService + counter: "widgetConsumers" + active: root.visible && root.playing + } + DrawerShape { + bodyWidth: root.width - 2 * BarDrawers.ear + bodyHeight: root.height + ear: BarDrawers.ear + radius: Math.min(Theme.radius, root.height / 2) + } + Row { + id: content + anchors.centerIn: parent + 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 + } + } + } + } + MouseArea { + anchors.fill: parent + anchors.leftMargin: BarDrawers.ear + anchors.rightMargin: BarDrawers.ear + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: mouse => { + if (mouse.button === Qt.RightButton) + MediaService.toggle(); + else + ShellState.toggleNotch(); + } + // Wheel changes the volume, as on pocket-dots. + onWheel: wheel => { + const audio = AudioService.sink ? AudioService.sink.audio : null; + const step = ConfigService.ready ? ConfigService.data.osd.step : 5; + if (audio && wheel.angleDelta.y !== 0) + AudioService.volume(false, audio.volume + (wheel.angleDelta.y > 0 ? 1 : -1) * step / 100); + } + } +} diff --git a/quickshell/notifications/NotificationPopups.qml b/quickshell/notifications/NotificationPopups.qml index 0247235..f855642 100644 --- a/quickshell/notifications/NotificationPopups.qml +++ b/quickshell/notifications/NotificationPopups.qml @@ -21,7 +21,7 @@ PanelWindow { // The OSD capsule takes this spot while it is up; banners wait behind it. readonly property var osd: ShellState.osdWindow readonly property bool yielding: !!osd && osd.shown && osd.options.position === options.position - readonly property bool shown: NotificationService.active && items.length > 0 && !yielding && !ShellState.controlCenterOpen + readonly property bool shown: NotificationService.active && items.length > 0 && !yielding && !ShellState.controlCenterOpen && !ShellState.notchOpen onItemsChanged: if (items.length > 0 && !drawer.shown) targetScreen = ScreenService.active // Control Center lists everything; banners would cover it. @@ -31,6 +31,11 @@ PanelWindow { if (ShellState.controlCenterOpen) NotificationService.clearPopups(); } + // The notch lists everything too. + function onNotchOpenChanged() { + if (ShellState.notchOpen) + NotificationService.clearPopups(); + } } anchors { diff --git a/quickshell/osd/Osd.qml b/quickshell/osd/Osd.qml index 9c9d020..0f056ad 100644 --- a/quickshell/osd/Osd.qml +++ b/quickshell/osd/Osd.qml @@ -80,7 +80,7 @@ PanelWindow { } function show(next) { // Control Center already shows these levels. - if (!options.enabled || !armed || ShellState.controlCenterOpen) + if (!options.enabled || !armed || ShellState.controlCenterOpen || ShellState.notchOpen) return; if (!shown) targetScreen = ScreenService.active; diff --git a/quickshell/services/ConfigLogic.js b/quickshell/services/ConfigLogic.js index 904d2aa..5848d0c 100644 --- a/quickshell/services/ConfigLogic.js +++ b/quickshell/services/ConfigLogic.js @@ -84,6 +84,7 @@ function validate(c) { if(!dash || ["enabled","openFromClock","rememberTab","easyEffects"].some(k=>typeof dash[k]!=="boolean") || !["top-left","top-center","top-right","center"].includes(dash.position) || !Array.isArray(dash.tabs))throw Error("Invalid dashboard preferences"); const dashTabs=new Set(); for(const t of dash.tabs) { if(!t || typeof t.id!=="string" || dashTabs.has(t.id) || typeof t.enabled!=="boolean")throw Error("Invalid dashboard tab"); dashTabs.add(t.id); } + if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences"); if(typeof c.osd.enabled!=="boolean" || !["slide","drop","fade","shrink"].includes(c.osd.animation) || !["top-right","top-center","bottom-center"].includes(c.osd.position) || !Number.isInteger(c.osd.timeout) || c.osd.timeout<500 || c.osd.timeout>5000 || !Number.isInteger(c.osd.step) || c.osd.step<1 || c.osd.step>20)throw Error("Invalid OSD preferences"); const notes=c.notifications; if(!notes || ["enabled","doNotDisturb","criticalInDnd"].some(k=>typeof notes[k]!=="boolean") || !["slide","drop","fade","shrink"].includes(notes.animation) || !["top-right","top-center"].includes(notes.position) || !Number.isInteger(notes.timeout) || notes.timeout<1000 || notes.timeout>30000 || !Number.isInteger(notes.maxPopups) || notes.maxPopups<1 || notes.maxPopups>6)throw Error("Invalid notification preferences"); diff --git a/quickshell/services/PluginService.qml b/quickshell/services/PluginService.qml index 098a26e..7d9f9a2 100644 --- a/quickshell/services/PluginService.qml +++ b/quickshell/services/PluginService.qml @@ -239,6 +239,7 @@ Singleton { activePopout.close(); activePopout = owner; ShellState.controlCenterOpen = false; + ShellState.notchOpen = false; ShellState.dashboardOpen = false; PopoutState.close(); TrayService.close(); diff --git a/quickshell/services/PowerService.qml b/quickshell/services/PowerService.qml index 69415a0..8c9d5d5 100644 --- a/quickshell/services/PowerService.qml +++ b/quickshell/services/PowerService.qml @@ -39,6 +39,10 @@ Singleton { if (!ShellState.controlCenterOpen) root.cancel(); } + function onNotchOpenChanged() { + if (!ShellState.notchOpen) + root.cancel(); + } function onSettingsPageChanged() { root.cancel(); } diff --git a/quickshell/services/SystemService.qml b/quickshell/services/SystemService.qml index 0922961..84ac1b8 100644 --- a/quickshell/services/SystemService.qml +++ b/quickshell/services/SystemService.qml @@ -16,7 +16,7 @@ Singleton { readonly property var features: { if (!ConfigService.ready) return []; - if (ShellState.controlCenterOpen) + if (ShellState.controlCenterOpen || ShellState.notchOpen) return ConfigService.data.controlCenter.modules.filter(m => m.enabled && ["brightness", "nightLight", "dnd", "profiles", "power"].includes(m.id)).map(m => m.id); if (ShellState.dashboardOpen) return ["power"]; diff --git a/quickshell/services/TrayService.qml b/quickshell/services/TrayService.qml index 5340058..bb502be 100644 --- a/quickshell/services/TrayService.qml +++ b/quickshell/services/TrayService.qml @@ -71,6 +71,7 @@ Singleton { if (!options.enabled || !item || !item.hasMenu || !icon) return false; ShellState.controlCenterOpen = false; + ShellState.notchOpen = false; ShellState.launcherOpen = false; ShellState.settingsOpen = false; currentItem = item; diff --git a/quickshell/settings/Settings.qml b/quickshell/settings/Settings.qml index eba55fd..c34edf4 100644 --- a/quickshell/settings/Settings.qml +++ b/quickshell/settings/Settings.qml @@ -302,6 +302,8 @@ PanelWindow { return osd; case "dashboard": return dashboardPage; + case "notch": + return notchPage; case "plugins": return pluginsPage; case "launcher": @@ -422,6 +424,10 @@ PanelWindow { id: dashboardPage Pages.Dashboard {} } + Component { + id: notchPage + Pages.Notch {} + } Component { id: lockPage Pages.Lock {} diff --git a/quickshell/settings/pages/Notch.qml b/quickshell/settings/pages/Notch.qml new file mode 100644 index 0000000..187e6b7 --- /dev/null +++ b/quickshell/settings/pages/Notch.qml @@ -0,0 +1,43 @@ +import QtQuick +import "../controls" +import "../../components" +import "../../core" +import "../../services" + +SettingsPage { + id: root + readonly property var options: ConfigService.data.notch + SettingsSection { + title: "Notch" + description: "Splits the bar into side islands with a notch at the top centre. Super+C, Super+X and a click on the notch open it: dashboard pages on the left (scroll to switch), controls and weather in the middle, notifications on the right. The launcher drops out of it." + PreferenceToggle { + label: "Notch" + description: root.options.enabled ? "On: notch mode" : "Off: the full bar" + icon: "󰹑" + setting: "notch.enabled" + } + } + SettingsSection { + title: "Opening" + enabled: root.options.enabled + PreferenceToggle { + label: "Open on Media while audio plays" + description: "Otherwise it opens on the last page" + icon: "󰝚" + setting: "notch.mediaFirst" + } + SettingRow { + title: "Preview" + icon: "󰈈" + GlassButton { + objectName: "notchOpenButton" + text: "Open notch" + enabled: root.options.enabled + onClicked: ShellState.openNotch() + } + } + } + SettingNote { + text: "The middle column uses your Control Center tiles; change them in Control Center → Edit Controls." + } +} diff --git a/quickshell/shell.qml b/quickshell/shell.qml index 5ebd7c6..e13a56d 100644 --- a/quickshell/shell.qml +++ b/quickshell/shell.qml @@ -15,6 +15,7 @@ import "widgets" import "wallpaper" import "controlcenter" import "dashboard" +import "notch" import "overview" import "osd" import "notifications" @@ -37,6 +38,7 @@ ShellRoot { WallpaperPicker {} ControlCenter {} Dashboard {} + Notch {} Overview {} PluginHost {} Osd {} @@ -106,6 +108,7 @@ ShellRoot { ShellState.wallpaperPickerOpen = false; ShellState.controlCenterOpen = false; ShellState.dashboardOpen = false; + ShellState.notchOpen = false; ShellState.overviewOpen = false; ShellState.settingsOpen = false; ShellState.launcherOpen = false; diff --git a/quickshell/widgets/WidgetState.qml b/quickshell/widgets/WidgetState.qml index c97496c..0699261 100644 --- a/quickshell/widgets/WidgetState.qml +++ b/quickshell/widgets/WidgetState.qml @@ -142,6 +142,7 @@ Singleton { function edit(id) { ShellState.settingsOpen = false; ShellState.controlCenterOpen = false; + ShellState.notchOpen = false; ShellState.launcherOpen = false; ShellState.wallpaperPickerOpen = false; selected = id || "";