From 7d246837879102fe5c18e40b2fed73af34ca07dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Sat, 6 Sep 2025 11:12:33 +0800 Subject: [PATCH] vanadium: set ddc brightness with autorandr --- nix/configurations/vanadium/nixos/display.nix | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index c6e1c3c6..476195d8 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -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