diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index 7669d4ec..95b8e649 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -50,13 +50,22 @@ */ genAttrs' = xs: func: builtins.listToAttrs (map func xs); - mkExtSwitch = {dpi}: { + mkDpiSwitch = {dpi}: { "10_xrdb-dpi" = "xrdb -merge ${pkgs.writeText "xrdb-dpi-config" '' Xcursor.size: 64 Xft.dpi: ${toString dpi} ''}"; }; + mkBrightnessSwitch = { + device, + brightness, + }: { + "10_xrandr_brightness" = '' + xrandr --output ${device} --brightness ${toString brightness} + ''; + }; + # Note: the "position" field corresponds to the "pos" field outputted by autorandr # To get the current config, run `xrandr --auto` and then `autorandr --config` configs = { @@ -89,7 +98,7 @@ fingerprint.eDP-1 = built-in; config = with configs; allOff // enableBuiltin; - hooks.postswitch = mkExtSwitch {dpi = 150;}; + hooks.postswitch = mkDpiSwitch {dpi = 150;}; }; mkAsusProfile = name: { @@ -99,7 +108,12 @@ }; config = with configs; allOff // enableDevice name; - hooks.postswitch = mkExtSwitch {dpi = 110;}; + hooks.postswitch = + mkDpiSwitch {dpi = 110;} + // mkBrightnessSwitch { + device = name; + brightness = 0.7; # just a random sensible choice + }; }; in {default = frameworkBuiltin;}