import QtQuick import QtQuick.Layouts import Quickshell import Quickshell.Io import "." Item { id: root // Bar power popup keeps the legacy quick actions visible while the confirmed // PowerMenu becomes the real replacement. Destructive actions stay dry-run // here so rollout cannot accidentally reboot or power off the session. required property QtObject theme required property QtObject commands required property var barWindow property bool open: false property string uptime: "" implicitWidth: button.implicitWidth implicitHeight: button.implicitHeight function refresh(): void { up.exec(["sh", "-c", "uptime -p | cut -d ' ' -f2-"]) } StatusItem { id: button theme: root.theme text: "󰐥" minWidth: 24 active: root.open onLeftClicked: { root.open = !root.open if (root.open) root.refresh() } } PopupWindow { visible: root.open implicitWidth: 260 implicitHeight: 184 color: "transparent" anchor { window: root.barWindow item: button gravity: Edges.Bottom adjustment: PopupAdjustment.Slide } Rectangle { anchors.fill: parent radius: 7 color: root.theme.ui.backdrop border.width: 2 border.color: root.theme.ui.accent ColumnLayout { anchors.fill: parent anchors.margins: 10 spacing: 8 Text { Layout.fillWidth: true text: `up ${root.uptime}` color: root.theme.ui.important_global font.family: "IBM Plex Mono" font.pixelSize: 12 horizontalAlignment: Text.AlignHCenter } GridLayout { Layout.fillWidth: true columns: 2 rowSpacing: 6 columnSpacing: 6 // Only lock is live in Phase 2C. Destructive/session actions are // deliberately dry-run until a later confirmed power replacement. StatusItem { theme: root.theme; text: "󰌾 lock"; minWidth: 110; onLeftClicked: root.commands.lock() } StatusItem { theme: root.theme; text: "󰤄 sleep"; minWidth: 110; muted: true; onLeftClicked: root.commands.dryRunPower("sleep") } StatusItem { theme: root.theme; text: "󰍃 out"; minWidth: 110; muted: true; onLeftClicked: root.commands.dryRunPower("logout") } StatusItem { theme: root.theme; text: "󰜉 reboot"; minWidth: 110; critical: true; onLeftClicked: root.commands.dryRunPower("reboot") } StatusItem { theme: root.theme; text: "󰐥 off"; minWidth: 110; critical: true; onLeftClicked: root.commands.dryRunPower("poweroff") } } } } } Process { id: up stdout: StdioCollector { onStreamFinished: root.uptime = this.text.trim() } } }