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 }); } } }