picom: use types.numbers.between

Mirrors 77307fcff8
This commit is contained in:
Naïm Favier 2022-09-29 11:34:00 +02:00
parent 6dc8a43f39
commit 28334988db
No known key found for this signature in database
GPG key ID: 95AFCE8211908325

View file

@ -16,16 +16,6 @@ let
description = "pair of ${x.description}";
};
floatBetween = a: b:
with types;
let
# toString prints floats with hardcoded high precision
floatToString = f: toJSON f;
in addCheck float (x: x <= b && x >= a) // {
description = "a floating point number in "
+ "range [${floatToString a}, ${floatToString b}]";
};
mkDefaultAttrs = mapAttrs (n: v: mkDefault v);
# Basically a tinkered lib.generators.mkKeyValueDefault
@ -96,7 +86,7 @@ in {
};
fadeSteps = mkOption {
type = pairOf (floatBetween 1.0e-2 1);
type = pairOf (types.numbers.between 1.0e-2 1);
default = [ 2.8e-2 3.0e-2 ];
example = [ 4.0e-2 4.0e-2 ];
description = ''
@ -132,7 +122,7 @@ in {
};
shadowOpacity = mkOption {
type = floatBetween 0 1;
type = types.numbers.between 0 1;
default = 0.75;
example = 0.8;
description = ''
@ -151,7 +141,7 @@ in {
};
activeOpacity = mkOption {
type = floatBetween 0 1;
type = types.numbers.between 0 1;
default = 1.0;
example = 0.8;
description = ''
@ -160,7 +150,7 @@ in {
};
inactiveOpacity = mkOption {
type = floatBetween 0.1 1;
type = types.numbers.between 0.1 1;
default = 1.0;
example = 0.8;
description = ''
@ -169,7 +159,7 @@ in {
};
menuOpacity = mkOption {
type = floatBetween 0 1;
type = types.numbers.between 0 1;
default = 1.0;
example = 0.8;
description = ''