aboutsummaryrefslogtreecommitdiff
path: root/modules/system/quickshell/BrightnessService.qml
diff options
context:
space:
mode:
authorLeander Scherer <leander@schererleander.de>2026-05-30 15:35:27 +0200
committerLeander Scherer <leander@schererleander.de>2026-05-30 15:35:27 +0200
commitd2747e2ca1e211a32e91e44010f40a00e0ac97e4 (patch)
treefb229d6a18541c7a5f1944390b21edde028955f9 /modules/system/quickshell/BrightnessService.qml
parent51b3cbd50b92d026549ce3ebff17ca9b3344f441 (diff)
feat(quickshell): add popup controls and privacy indicators
Diffstat (limited to 'modules/system/quickshell/BrightnessService.qml')
-rw-r--r--modules/system/quickshell/BrightnessService.qml21
1 files changed, 10 insertions, 11 deletions
diff --git a/modules/system/quickshell/BrightnessService.qml b/modules/system/quickshell/BrightnessService.qml
index 991a6ec..6142188 100644
--- a/modules/system/quickshell/BrightnessService.qml
+++ b/modules/system/quickshell/BrightnessService.qml
@@ -2,31 +2,30 @@ 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
+ updateProc.running = true;
}
function setBrightness(value) {
- const raw = Math.round(value * maxBrightness)
- Quickshell.execDetached(["brightnessctl", "s", raw.toString()])
- brightness = 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"]
+ command: ["sh", "-c", "printf '%s %s\\n' \"$(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
+ const parts = data.trim().split(/\s+/);
+ if (parts.length >= 2) {
+ const current = parseInt(parts[0]);
+ root.maxBrightness = parseInt(parts[1]);
+ root.brightness = current / root.maxBrightness;
}
}
}