import Quickshell import Quickshell.Wayland import Quickshell.Hyprland import QtQuick import QtQuick.Layouts import Quickshell.Io PanelWindow { anchors.top: true anchors.left: true anchors.right: true implicitHeight: 38 //color: root.colBg id: root color: "transparent" // Theme property property color colBg: '#1e1e2e' property color colCyan: '#94e2d5' property color colBlue: '#89b4fa' property color colYellow: '#e0af68' property color colMuted: '#313244' property color coltxt: '#cdd6f4' property string fontFamily: "CaskaydiaCove Nerd Font Mono" property int fontSize: 18 // System Data property int cpuUsage: 0 property var lastCpuIdle: 0 property var lastCpuTotal: 0 Process { id: cpuProc command: ["sh", "-c", "head -1 /proc/stat"] stdout: SplitParser { onRead: data => { if (!data) return var p = data.trim().split(/\s+/) var idle = parseInt(p[4]) + parseInt(p[5]) var total = p.slice(1, 8).reduce((a, b) => a + parseInt(b), 0) if (lastCpuTotal > 0) { cpuUsage = Math.round(100 * (1 - (idle - lastCpuIdle) / (total - lastCpuTotal))) } lastCpuTotal = total lastCpuIdle = idle } } Component.onCompleted: running = true } Timer { interval: 2000 // Every 2 seconds running: true // Start immediately repeat: true // Keep going forever onTriggered: cpuProc.running = true } RowLayout { anchors.fill: parent anchors.margins: 8 spacing: 3 Repeater { model: 10 Text { property var ws: Hyprland.workspaces.values.find(w => w.id === index + 1) property bool isActive: Hyprland.focusedWorkspace?.id === (index + 1) text: isActive ? "" : "" //" color: isActive ? root.colCyan : (ws ? root.colBlue : root.colMuted) font { pixelSize: 14; bold: true } MouseArea { anchors.fill: parent onClicked: Hyprland.dispatch("workspace " + (index + 1)) } } } Rectangle { color: "transparent" Layout.fillWidth: true Layout.fillHeight: true } Rectangle{ //anchors.fill: parent //color: parent.color Layout.fillHeight: true implicitWidth: 100 color: root.colBg radius: 8 Text { id: clock text: Qt.formatDateTime(new Date(), "HH:mm") color: root.coltxt font { family: root.fontFamily; pixelSize: root.fontSize; bold: true} Timer { interval: 1000 running: true repeat: true onTriggered: clock.text = Qt.formatDateTime(new Date(), "HH:mm") } } } Rectangle { color: "transparent" Layout.fillWidth: true Layout.fillHeight: true } Text { text: "CPU: " + cpuUsage + "%" color: root.colYellow font { family: root.fontFamily; pixelSize: root.fontSize; bold: true} } } }