This commit is contained in:
end-4
2025-04-21 17:51:28 +02:00
parent 9678751156
commit 0faf9287ba
13 changed files with 392 additions and 28 deletions
+1
View File
@@ -7,6 +7,7 @@ pragma ComponentBehavior: Bound
Singleton {
id: root
property bool ready: Pipewire.defaultAudioSink.ready
property var sink: Pipewire.defaultAudioSink
property var source: Pipewire.defaultAudioSource
+26 -10
View File
@@ -6,22 +6,22 @@ pragma ComponentBehavior: Bound
Singleton {
id: root
property string brightness
property int value: 0
property bool ready: false
property real value
property int increment: 0
function refresh() {
getBrightness.running = true;
}
onValueChanged: () => {
if (value > 0) {
onIncrementChanged: () => {
if (increment > 0) {
increaseBrightness.running = true;
root.value = 0;
} else if (value < 0) {
root.increment = 0;
} else if (increment < 0) {
decreaseBrightness.running = true;
root.value = 0;
root.increment = 0;
}
getBrightness.running = true;
}
Process {
@@ -30,12 +30,15 @@ Singleton {
command: ["sh", "-c", "brightnessctl -m i | cut -d, -f4"]
running: true
onExited: {
running = false;
if (!ready) ready = true
}
stdout: SplitParser {
onRead: (data) => {
root.brightness = data;
root.value = parseFloat(data.replace("%", "")) / 100;
if (root.value < 0.01) {
preventPitchBlack.running = true;
}
}
}
@@ -48,6 +51,7 @@ Singleton {
running: false
onExited: {
running = false;
getBrightness.running = true;
}
}
@@ -58,6 +62,18 @@ Singleton {
running: false
onExited: {
running = false;
getBrightness.running = true;
}
}
Process {
id: preventPitchBlack
command: ["brightnessctl", "set", "1%+"]
running: false
onExited: {
running = false;
getBrightness.running = true;
}
}