diff options
Diffstat (limited to 'desktop/island/StatusPill.qml')
| -rw-r--r-- | desktop/island/StatusPill.qml | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/desktop/island/StatusPill.qml b/desktop/island/StatusPill.qml index 20529ef..dd97855 100644 --- a/desktop/island/StatusPill.qml +++ b/desktop/island/StatusPill.qml @@ -14,11 +14,13 @@ import Quickshell.Widgets import Quickshell.Services.SystemTray import QtQuick import ".." +import "perf" import "Logic.js" as Logic -// Controls icon, volume icon, tray, layout flag. The controls and volume -// icons open their panels in this capsule; the tray is a plain tray; the -// flag switches layout on scroll and ignores clicks. +// Performance icon, controls icon, volume icon, tray, layout flag. The +// performance, controls and volume icons open their panels in this capsule; +// the tray is a plain tray; the flag switches layout on scroll and ignores +// clicks. Capsule { id: pill @@ -29,16 +31,23 @@ Capsule { signal openSound() signal openControls() + signal openPerf() signal openDrawer() // A drawer page, from a control tile's right-click. signal openPage(string page) // Emitted just before a tray menu opens; the menu cannot report its close. signal menuShown() - expanded: panel === "sound" || panel === "controls" + expanded: panel === "sound" || panel === "controls" || panel === "perf" restWidth: restRow.implicitWidth + 24 - panelWidth: 320 - panelHeight: (panel === "controls" ? controlsPanel.implicitHeight : soundPanel.implicitHeight) + 28 + panelWidth: panel === "perf" ? 600 : 320 + panelHeight: (panel === "controls" ? controlsPanel.implicitHeight + : panel === "perf" ? perfPanel.implicitHeight + : soundPanel.implicitHeight) + 28 + + // The detailed sampling (per-core, network, VRAM) runs only while the + // panel shows it. + Binding { target: Perf; property: "detailed"; value: pill.panel === "perf" } // Edit mode never outlives its panel. onPanelChanged: controlsPanel.editing = false @@ -51,6 +60,36 @@ Capsule { visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: 120 } } + // The worst severity as a dot on the corner: IconImage cannot be + // recoloured without an effect layer. Never the accent (AGENTS.md). + Item { + anchors.verticalCenter: parent.verticalCenter + width: 18 + height: 18 + + IconImage { + anchors.fill: parent + source: Quickshell.iconPath("utilities-system-monitor", true) + } + + Rectangle { + anchors { right: parent.right; top: parent.top; rightMargin: -2; topMargin: -2 } + width: 8 + height: 8 + radius: 4 + visible: Perf.severity !== "ok" + color: Perf.severity === "crit" ? Theme.red : Theme.yellow + border.width: 1 + border.color: Theme.base + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: pill.openPerf() + } + } + IconImage { anchors.verticalCenter: parent.verticalCenter implicitSize: 18 @@ -151,4 +190,14 @@ Capsule { Behavior on opacity { NumberAnimation { duration: 160 } } onOpenDrawer: page => pill.openPage(page) } + + PerfPanel { + id: perfPanel + x: 14 + y: 14 + width: 600 - 28 + opacity: pill.panel === "perf" ? 1 : 0 + visible: opacity > 0 + Behavior on opacity { NumberAnimation { duration: 160 } } + } } |
