import QtQuick import "../.." import "osd.js" as OsdModel import "../../human.js" as Human // Glance-only OSD card. Mirrors the notification card's visual language // (backdrop alpha, radius, IBM Plex, accent) with the bar's Nerd Font glyphs, but has no close, // actions or body. Non-interactive: the overlay host passes clicks through. // The panel fills the overlay surface; its implicit height includes the // card's offset below the bar so the surface hugs the card. Item { id: root required property Theme theme required property Osd osdService implicitHeight: osdCard.implicitHeight + 64 Rectangle { id: osdCard readonly property var indicator: root.osdService.valueIndicator(root.osdService.currentEvent, root.osdService.currentValue) readonly property string roleColor: root.osdService.currentRole === "error" ? root.theme.error : (root.osdService.currentRole === "warning" ? root.theme.warning : root.theme.ui.accent) readonly property bool hasBar: indicator.progressBar && indicator.progressBar.visible readonly property bool isError: root.osdService.currentRole === "error" objectName: "osdCard" anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top anchors.topMargin: 56 anchors.rightMargin: 24 anchors.leftMargin: 8 anchors.bottomMargin: 8 implicitHeight: osdRow.implicitHeight + 24 radius: root.theme.radiusSurface color: root.theme.withAlpha(root.theme.ui.backdrop, 0.92) opacity: root.osdService.visibleState ? 1 : 0 // left accent strip, like the notification card's urgency bar Rectangle { anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom width: 3 radius: width / 2 color: osdCard.roleColor } Row { id: osdRow anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: 14 anchors.rightMargin: 14 anchors.verticalCenter: parent.verticalCenter spacing: 12 Rectangle { anchors.verticalCenter: parent.verticalCenter width: 40 height: 40 radius: root.theme.radiusTile color: root.theme.withAlpha(osdCard.roleColor, 0.18) Text { objectName: "osdIcon" anchors.centerIn: parent color: osdCard.roleColor font.family: root.theme.fontIcon font.pixelSize: 22 text: OsdModel.glyph(root.osdService.currentEvent, root.osdService.currentValue) } } Column { width: parent.width - 40 - parent.spacing anchors.verticalCenter: parent.verticalCenter spacing: 7 Row { width: parent.width spacing: 8 Text { id: osdLabel objectName: "osdLabel" color: root.theme.content.normal font.family: root.theme.fontSans font.pixelSize: root.theme.textBody font.bold: true text: Human.text(osdCard.indicator.displayLabel, "error") width: parent.width - osdValue.width - parent.spacing elide: Text.ElideRight } Text { id: osdValue objectName: "osdValue" anchors.baseline: osdLabel.baseline color: osdCard.hasBar ? osdCard.roleColor : root.theme.ui.normal font.family: root.theme.fontMono font.pixelSize: osdCard.hasBar ? root.theme.textBody : root.theme.textMeta font.bold: osdCard.hasBar text: osdCard.isError ? "" : Human.text(osdCard.indicator.displayValue || "") } } // hero meter for volume/brightness/microphone levels Rectangle { width: parent.width height: osdCard.hasBar ? 5 : 0 visible: osdCard.hasBar radius: height / 2 color: root.theme.withAlpha(root.theme.ui.minor, 0.28) Rectangle { anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom width: parent.width * Math.max(0, Math.min(1, osdCard.indicator.normalizedValue || 0)) radius: parent.radius color: osdCard.roleColor Behavior on width { NumberAnimation { duration: root.theme.lowPowerMode ? 0 : 160 easing.type: Easing.OutCubic } } } } // an error's failure reads in the body line, below its subject Text { objectName: "osdMessage" visible: osdCard.isError color: root.theme.error font.family: root.theme.fontSans font.pixelSize: root.theme.textMeta text: Human.text(osdCard.indicator.protectionMessage.text) width: parent.width wrapMode: Text.Wrap } } } Behavior on opacity { NumberAnimation { duration: root.theme.lowPowerMode ? 0 : 120 easing.type: Easing.OutCubic } } } }