mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
Rename maxBrightness to rawMaxBrightness
less confusing because `brightness` is percentage
This commit is contained in:
@@ -76,7 +76,7 @@ Singleton {
|
||||
required property ShellScreen screen
|
||||
readonly property bool isDdc: root.ddcMonitors.some(m => m.model === screen.model)
|
||||
readonly property string busNum: root.ddcMonitors.find(m => m.model === screen.model)?.busNum ?? ""
|
||||
property int maxBrightness: 100
|
||||
property int rawMaxBrightness: 100
|
||||
property real brightness
|
||||
property bool ready: false
|
||||
|
||||
@@ -96,8 +96,8 @@ Singleton {
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
const [, , , current, max] = data.split(" ");
|
||||
monitor.maxBrightness = parseInt(max);
|
||||
monitor.brightness = parseInt(current) / monitor.maxBrightness;
|
||||
monitor.rawMaxBrightness = parseInt(max);
|
||||
monitor.brightness = parseInt(current) / monitor.rawMaxBrightness;
|
||||
monitor.ready = true;
|
||||
}
|
||||
}
|
||||
@@ -105,8 +105,8 @@ Singleton {
|
||||
|
||||
function setBrightness(value: real): void {
|
||||
value = Math.max(0.01, Math.min(1, value));
|
||||
const rounded = Math.round(value * monitor.maxBrightness);
|
||||
if (Math.round(brightness * monitor.maxBrightness) === rounded)
|
||||
const rounded = Math.round(value * monitor.rawMaxBrightness);
|
||||
if (Math.round(brightness * monitor.rawMaxBrightness) === rounded)
|
||||
return;
|
||||
brightness = value;
|
||||
setProc.command = isDdc ? ["ddcutil", "-b", busNum, "setvcp", "10", rounded] : ["brightnessctl", "s", rounded, "--quiet"];
|
||||
|
||||
Reference in New Issue
Block a user