lol

nixos/light: add minBrightness option (#386182)

authored by

Pol Dellaiera and committed by
GitHub
75cd88fa 41bb262e

+12 -2
+12 -2
nixos/modules/programs/light.nix
··· 49 49 ''; 50 50 }; 51 51 52 + minBrightness = lib.mkOption { 53 + type = lib.types.numbers.between 0 100; 54 + default = 0.1; 55 + description = '' 56 + The minimum authorized brightness value, e.g. to avoid the 57 + display going dark. 58 + ''; 59 + }; 60 + 52 61 }; 53 62 54 63 }; ··· 63 72 let 64 73 light = "${pkgs.light}/bin/light"; 65 74 step = builtins.toString cfg.brightnessKeys.step; 75 + minBrightness = builtins.toString cfg.brightnessKeys.minBrightness; 66 76 in 67 77 [ 68 78 { 69 79 keys = [ 224 ]; 70 80 events = [ "key" ]; 71 - # Use minimum brightness 0.1 so the display won't go totally black. 72 - command = "${light} -N 0.1 && ${light} -U ${step}"; 81 + # -N is used to ensure that value >= minBrightness 82 + command = "${light} -N ${minBrightness} && ${light} -U ${step}"; 73 83 } 74 84 { 75 85 keys = [ 225 ];