pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import Quickshell import Quickshell.Io import Quickshell.Wayland import "../components" import "../bar" import "../controlcenter" import "../controlcenter/GridLogic.js" as Grid import "../core" import "../dashboard" 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 // The open notch's header: the band plus room for the divider below it. readonly property real header: band + 8 readonly property int gutter: 16 // 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) property real progress: ShellState.notchOpen ? 1 : 0 Behavior on progress { NumberAnimation { id: morph duration: ShellState.notchOpen ? Theme.notchOpenDuration * 2 : Theme.notchCloseDuration * 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.notchDuration * 1.4 easing.type: Easing.BezierSpline easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } } Behavior on targetHeight { enabled: root.settled NumberAnimation { duration: Theme.notchDuration * 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 // Screen x of this centred layer, so bar popouts (plugin tooltips) anchored // in the strip land under their module. readonly property real screenOffsetX: Math.round((screenWidth - implicitWidth) / 2) 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" // A plugin panel opened from the strip takes focus (and the pointer) while it is open. WlrLayershell.keyboardFocus: ShellState.notchOpen && !PluginService.activePopout ? 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(); } } } // Keyboard focus comes back once a plugin panel from the strip closes. Connections { target: PluginService function onActivePopoutChanged() { if (!PluginService.activePopout && ShellState.notchOpen) 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) // Fades between the docked and open fill at its own speed; closing, it // never outlasts the shrink so it docks in the docked colour. fillColor: ShellState.notchOpen ? Theme.notchOpenFill : Theme.notchFill Behavior on fillColor { ColorAnimation { duration: ShellState.notchOpen ? Theme.notchColorDuration : Math.min(Theme.notchColorDuration, Theme.notchCloseDuration * 1.3) } } } 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 { id: clockRow 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 } } // 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 Flickable { id: strip objectName: "notchStrip" x: main.x width: Math.max(0, clockRow.x - 24 - main.x) height: root.band visible: body.headerShown opacity: root.contentOpacity contentWidth: stripRow.implicitWidth contentHeight: height flickableDirection: Flickable.HorizontalFlick boundsBehavior: Flickable.StopAtBounds clip: true ModuleRow { id: stripRow position: "center" active: ShellState.notchOpen modules: BarLayout.notchModules(root.screen ? root.screen.name : "", "strip") barScreen: root.screen anchors.verticalCenter: parent.verticalCenter } } // Empty strip: a shortcut to pick its modules. Rectangle { objectName: "notchStripAdd" x: main.x y: (root.band - height) / 2 width: addLabel.implicitWidth + 24 height: 28 radius: 14 visible: body.headerShown && stripRow.modules.length === 0 opacity: root.contentOpacity color: addArea.containsMouse ? Theme.hover : Theme.fill border.width: 1 border.color: Theme.hairline Text { id: addLabel anchors.centerIn: parent text: "+ Add bar modules" color: Theme.textSecondary font.pixelSize: 12 } MouseArea { id: addArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: ShellState.revealSetting("notch", "Notch strip") } } MouseArea { anchors.fill: strip visible: strip.visible acceptedButtons: Qt.NoButton onWheel: wheel => { const delta = wheel.angleDelta.y !== 0 ? wheel.angleDelta.y : wheel.angleDelta.x; strip.contentX = Math.max(0, Math.min(strip.contentWidth - strip.width, strip.contentX - delta * 0.6)); } } Rectangle { objectName: "notchEditControls" x: main.x + root.sideWidth + root.columnGap + root.middleWidth - width y: (root.band - height) / 2 width: 30 height: 30 radius: 15 visible: body.headerShown opacity: root.contentOpacity color: cogArea.containsMouse ? Theme.hover : Theme.transparent Accessible.role: Accessible.Button Accessible.name: "Edit controls" Text { anchors.centerIn: parent text: Icons.available ? "󰒓" : "⚙" font.family: Icons.available ? Icons.family : "" font.pixelSize: 16 color: Theme.textSecondary } MouseArea { id: cogArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: ShellState.editControlCenter() } } Rectangle { x: main.x y: root.header width: main.width height: 1 visible: body.headerShown opacity: root.contentOpacity color: Theme.hairline } // Main view ---------------------------------------------------------- Item { id: main x: (root.bodyWidth - root.mainWidth) / 2 + root.pad y: root.header + root.gutter width: root.mainWidth - 2 * root.pad height: root.targetHeight - root.header - root.gutter - root.pad visible: opacity > 0 opacity: root.computer ? 0 : root.contentOpacity Behavior on opacity { enabled: root.settled NumberAnimation { duration: Theme.notchDuration } } // 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.notchDuration * 1.6 easing.type: Easing.BezierSpline easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } } // Media NotchMedia { width: pager.width - 16 height: pager.height active: ShellState.notchOpen && pager.page === 0 } // Performance: click for the full view. Item { id: perf width: pager.width - 16 height: pager.height readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({}) readonly property var gpu: MetricsService.gpu || ({}) readonly property var rows: [["CPU", [MetricsService.value(MetricsService.cpu.temperature, " °C"), MetricsService.value(MetricsService.cpu.frequency / 1000, " GHz", 2)].filter(v => v !== "—").join(" · ") || "—"], ["GPU", Number.isFinite(gpu.percent) ? Math.round(gpu.percent) + "%" + (Number.isFinite(gpu.temperature) ? " · " + Math.round(gpu.temperature) + " °C" : "") : "—"], ["Memory", MetricsService.bytes(MetricsService.ram.used) + " / " + MetricsService.bytes(MetricsService.ram.total)], ["Network", "↓ " + MetricsService.bytes(MetricsService.network.download) + "/s ↑ " + MetricsService.bytes(MetricsService.network.upload) + "/s"]] Demand { service: MetricsService active: ShellState.notchOpen && pager.page === 1 } Rectangle { anchors.fill: parent anchors.topMargin: 6 anchors.bottomMargin: 6 radius: Math.max(16, Theme.radius) color: perfArea.containsMouse ? Theme.hover : Theme.surfaceVariant border.width: 1 border.color: Theme.hairline Behavior on color { ColorAnimation { duration: Theme.notchDuration / 2 } } Column { anchors.centerIn: parent width: parent.width - 40 spacing: 22 Item { width: parent.width height: 24 Text { text: "Your computer" color: Theme.text font.pixelSize: 17 font.weight: Font.DemiBold } Text { anchors.right: parent.right text: Icons.available ? "󰅂" : "›" font.family: Icons.available ? Icons.family : "" color: Theme.textSecondary font.pixelSize: 20 } } Row { anchors.horizontalCenter: parent.horizontalCenter spacing: 10 Gauge { size: (perf.width - 40 - 20) / 3 value: MetricsService.cpu.percent caption: "CPU" } Gauge { size: (perf.width - 40 - 20) / 3 value: MetricsService.ram.percent caption: "Memory" } Gauge { size: (perf.width - 40 - 20) / 3 value: perf.disk.percent caption: "Disk" } } Column { width: parent.width Repeater { model: perf.rows Item { required property var modelData required property int index width: parent.width height: 38 Rectangle { visible: parent.index > 0 width: parent.width height: 1 color: Theme.hairline } Text { anchors.verticalCenter: parent.verticalCenter text: parent.modelData[0] color: Theme.textSecondary font.pixelSize: 13 } Text { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter text: parent.modelData[1] color: Theme.text font.pixelSize: 13 font.features: { "tnum": 1 } } } } } } MouseArea { id: perfArea objectName: "notchComputer" anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: ShellState.notchView = "computer" } } } // Calendar Item { width: pager.width - 16 height: pager.height Column { id: dateHead anchors.horizontalCenter: parent.horizontalCenter y: 6 Text { anchors.horizontalCenter: parent.horizontalCenter text: Qt.formatDateTime(clock.date, ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm") color: Theme.text font.pixelSize: 54 font.weight: Font.Light font.features: { "tnum": 1 } } Text { anchors.horizontalCenter: parent.horizontalCenter text: Qt.formatDateTime(clock.date, "dddd, d MMMM") color: Theme.textSecondary font.pixelSize: 14 } } Faces.CalendarFace { anchors.left: parent.left anchors.right: parent.right anchors.top: dateHead.bottom anchors.topMargin: 14 anchors.bottom: parent.bottom } } } // 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.notchDuration 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 y: -root.gutter width: 1 height: parent.height + root.gutter 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 // The notch's own layout keeps its edited cells; until edited it // follows the Control Center's order, packed, without Now Playing. readonly property bool ownLayout: ConfigService.ready && ConfigService.data.notch.controls.length > 0 readonly property var tiles: ControlRegistry.notchModules.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 middle.ownLayout ? { id: m.id, w: size.w, h: size.h, x: m.x, y: m.y } : { 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.notchDuration 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 y: -root.gutter width: 1 height: parent.height + root.gutter 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: 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 } } 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 editControls(): void { ShellState.editControlCenter(); } function toggleMode(): bool { return ShellState.toggleNotchMode(); } 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 }); } } }