forked from Shinonome/dots-hyprland
osd
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user