forked from Shinonome/dots-hyprland
fix wrong minimum brightness (#2310)
This commit is contained in:
@@ -16,8 +16,6 @@ import QtQuick
|
|||||||
*/
|
*/
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
property real minimumBrightnessAllowed: 0.00001 // Setting to 0 would kind of turn off the screen. We don't want that.
|
|
||||||
|
|
||||||
signal brightnessChanged()
|
signal brightnessChanged()
|
||||||
|
|
||||||
property var ddcMonitors: []
|
property var ddcMonitors: []
|
||||||
@@ -137,14 +135,14 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function syncBrightness() {
|
function syncBrightness() {
|
||||||
const brightnessValue = Math.max(monitor.multipliedBrightness, root.minimumBrightnessAllowed)
|
const brightnessValue = Math.max(monitor.multipliedBrightness, 0)
|
||||||
const rounded = Math.round(brightnessValue * monitor.rawMaxBrightness);
|
const rawValueRounded = Math.max(Math.floor(brightnessValue * monitor.rawMaxBrightness), 1);
|
||||||
setProc.command = isDdc ? ["ddcutil", "-b", busNum, "setvcp", "10", rounded] : ["brightnessctl", "--class", "backlight", "s", rounded, "--quiet"];
|
setProc.command = isDdc ? ["ddcutil", "-b", busNum, "setvcp", "10", rawValueRounded] : ["brightnessctl", "--class", "backlight", "s", rawValueRounded, "--quiet"];
|
||||||
setProc.startDetached();
|
setProc.startDetached();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBrightness(value: real): void {
|
function setBrightness(value: real): void {
|
||||||
value = Math.max(root.minimumBrightnessAllowed, Math.min(1, value));
|
value = Math.max(0, Math.min(1, value));
|
||||||
monitor.brightness = value;
|
monitor.brightness = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user