vanadium: set ddc brightness with autorandr

This commit is contained in:
Primrose 2025-09-06 11:12:33 +08:00
parent 88c97dd1b3
commit 7d24683787
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -58,13 +58,23 @@
# Is scoped to an output device, no need to be called on built-in display
setSoftwareBrightness = {
device,
brightness,
device, # obtain with `xrandr`
brightness, # [0..1]
}: {
"10_xrandr_brightness" = ''
xrandr --output ${device} --brightness ${toString brightness}
'';
};
# Is scoped to an output device, no need to be called on built-in display
setDDCBrightness = {
modelName, # obtain with `ddcutil detect`
brightness, # [0..1]
}: {
"10_ddc_brightness" = ''
ddcutil --model ${modelName} setvcp 10 ${toString (brightness * 100)}
'';
};
};
# Note: the "position" field corresponds to the "pos" field outputted by autorandr
@ -106,9 +116,13 @@
config = with configs; allOff // enableDevice name;
hooks.postswitch = with switches;
setDPI {dpi = 110;}
// setDDCBrightness {
modelName = "VG27AQL3A";
brightness = 0;
}
// setSoftwareBrightness {
device = name;
brightness = 0.7; # just a random sensible choice
brightness = 0.7;
};
};
in