nixos/light: add minBrightness option
Make the minimum brightness level configurable instead of using an arbitrary value of 0.1.
This commit is contained in:
parent
6313551cd0
commit
f7548cccda
@ -49,6 +49,15 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
minBrightness = lib.mkOption {
|
||||||
|
type = lib.types.numbers.between 0 100;
|
||||||
|
default = 0.1;
|
||||||
|
description = ''
|
||||||
|
The minimum authorized brightness value, e.g. to avoid the
|
||||||
|
display going dark.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -63,13 +72,14 @@ in
|
|||||||
let
|
let
|
||||||
light = "${pkgs.light}/bin/light";
|
light = "${pkgs.light}/bin/light";
|
||||||
step = builtins.toString cfg.brightnessKeys.step;
|
step = builtins.toString cfg.brightnessKeys.step;
|
||||||
|
minBrightness = builtins.toString cfg.brightnessKeys.minBrightness;
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
keys = [ 224 ];
|
keys = [ 224 ];
|
||||||
events = [ "key" ];
|
events = [ "key" ];
|
||||||
# Use minimum brightness 0.1 so the display won't go totally black.
|
# -N is used to ensure that value >= minBrightness
|
||||||
command = "${light} -N 0.1 && ${light} -U ${step}";
|
command = "${light} -N ${minBrightness} && ${light} -U ${step}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
keys = [ 225 ];
|
keys = [ 225 ];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user