From 9a7cf1242d296dbdb9c03df48ab09054960295aa Mon Sep 17 00:00:00 2001 From: Leander Scherer Date: Mon, 18 May 2026 21:48:24 +0200 Subject: feat(quickshell): basic bar, tray, notification --- modules/system/quickshell/BrightnessService.qml | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 modules/system/quickshell/BrightnessService.qml (limited to 'modules/system/quickshell/BrightnessService.qml') diff --git a/modules/system/quickshell/BrightnessService.qml b/modules/system/quickshell/BrightnessService.qml new file mode 100644 index 0000000..991a6ec --- /dev/null +++ b/modules/system/quickshell/BrightnessService.qml @@ -0,0 +1,36 @@ +import QtQuick +import Quickshell +import Quickshell.Io + +// Simplified brightness service using brightnessctl. +QtObject { + id: root + property real brightness: 0 + property int maxBrightness: 1 + + function update() { + updateProc.running = true + } + + function setBrightness(value) { + const raw = Math.round(value * maxBrightness) + Quickshell.execDetached(["brightnessctl", "s", raw.toString()]) + brightness = value + } + + readonly property Process updateProc: Process { + command: ["sh", "-c", "brightnessctl g && brightnessctl m"] + stdout: SplitParser { + onRead: data => { + const lines = data.trim().split("\n") + if (lines.length >= 2) { + const current = parseInt(lines[0]) + root.maxBrightness = parseInt(lines[1]) + root.brightness = current / root.maxBrightness + } + } + } + } + + Component.onCompleted: update() +} -- cgit v1.3.1