import QtQuick import Quickshell.Io import "." StatusItem { id: root property int percent: 0 text: `󰃠 ${percent}%` minWidth: 52 function refresh(): void { read.exec(["brightnessctl", "-m"]) } // Keep brightness changes outside Quickshell state. brightnessctl is already // the desktop's authoritative control path and handles backlight constraints. onWheelUp: change.exec(["brightnessctl", "-e4", "-n2", "set", "5%+"]) onWheelDown: change.exec(["brightnessctl", "-e4", "-n2", "set", "5%-"]) Timer { running: true repeat: true interval: 10000 triggeredOnStart: true onTriggered: root.refresh() } Process { id: read stdout: StdioCollector { onStreamFinished: { const fields = this.text.trim().split(",") if (fields.length >= 4) root.percent = parseInt(fields[3].replace("%", ""), 10) } } } Process { id: change onExited: root.refresh() } }