2022-03-23 13:10:18 +01:00
|
|
|
{pkgs, ...}: let
|
2021-06-01 22:42:38 +02:00
|
|
|
light = "${pkgs.light}/bin/light";
|
|
|
|
decLight = pkgs.writeScriptBin "decrease-light-smartly" ''
|
|
|
|
#!${pkgs.fish}/bin/fish
|
|
|
|
|
|
|
|
set curr (${light} -G)
|
|
|
|
|
|
|
|
if test $curr -le 5.00 -a $curr -gt 1.00
|
|
|
|
${light} -S 1
|
|
|
|
else
|
2021-08-16 16:17:55 +02:00
|
|
|
${light} -U 10
|
2021-06-01 22:42:38 +02:00
|
|
|
end
|
|
|
|
'';
|
|
|
|
|
|
|
|
incLight = pkgs.writeScriptBin "increase-light-smartly" ''
|
|
|
|
#!${pkgs.fish}/bin/fish
|
|
|
|
|
|
|
|
set curr (${light} -G)
|
|
|
|
|
|
|
|
if test $curr -eq 0.00
|
|
|
|
${light} -S 1
|
|
|
|
else
|
2021-08-16 16:17:55 +02:00
|
|
|
${light} -A 10
|
2021-06-01 22:42:38 +02:00
|
|
|
end
|
|
|
|
'';
|
|
|
|
in {
|
2021-05-22 22:17:13 +02:00
|
|
|
programs.light.enable = true;
|
|
|
|
|
2022-03-23 13:10:18 +01:00
|
|
|
environment.systemPackages = [incLight decLight pkgs.fish];
|
2021-06-01 22:42:38 +02:00
|
|
|
|
2021-05-22 22:17:13 +02:00
|
|
|
services.actkbd = {
|
|
|
|
enable = true;
|
|
|
|
bindings = [
|
2021-05-23 16:00:37 +02:00
|
|
|
{
|
2022-03-23 13:10:18 +01:00
|
|
|
keys = [225];
|
|
|
|
events = ["key"];
|
2021-06-01 22:42:38 +02:00
|
|
|
command = "${incLight}/bin/increase-light-smartly";
|
2021-05-22 22:17:13 +02:00
|
|
|
}
|
2021-05-23 16:00:37 +02:00
|
|
|
{
|
2022-03-23 13:10:18 +01:00
|
|
|
keys = [224];
|
|
|
|
events = ["key"];
|
2021-06-01 22:42:38 +02:00
|
|
|
command = "${decLight}/bin/decrease-light-smartly";
|
2021-05-22 22:17:13 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|