// MemoryWidget.qml - " X.XX / Y GB" import QtQuick import Quickshell.Io import ".." Pill { id: root property real usedGb: 0 property real totalGb: 0 onClicked: (m) => { if (m.button === Qt.LeftButton) Exec.run(["kitty", "-e", "btop"]) } Text { text: " " + root.usedGb.toFixed(2) + " / " + root.totalGb.toFixed(0) + " GB" font.family: Theme.fontSans font.pixelSize: Theme.fontSize color: Theme.foreground } Process { id: memProc running: false command: ["cat", "/proc/meminfo"] stdout: StdioCollector { onStreamFinished: { const text = this.text const total = parseInt((/MemTotal:\s+(\d+)/.exec(text) || [])[1] || "0") const avail = parseInt((/MemAvailable:\s+(\d+)/.exec(text) || [])[1] || "0") root.totalGb = total / 1048576 root.usedGb = (total - avail) / 1048576 } } onExited: memProc.running = false } Timer { interval: 5000; running: true; repeat: true triggeredOnStart: true onTriggered: memProc.running = true } }