dotfiles/hm/brightness/default.nix

54 lines
1.4 KiB
Nix
Raw Normal View History

2024-01-15 19:26:44 +01:00
# Light theme during the day, dark theme during the night (not automatic)
2024-12-15 00:29:51 +01:00
{
pkgs,
lib,
config,
...
}:
2024-01-15 19:26:44 +01:00
let
phases = [
2024-12-15 00:29:51 +01:00
{
command = "jour";
specialisation = null;
}
{
command = "crepuscule";
specialisation = "dark";
}
{
command = "nuit";
specialisation = "dark";
}
2024-01-15 19:26:44 +01:00
];
2024-06-20 16:47:58 +02:00
mod = config.xsession.windowManager.i3.config.modifier;
2024-01-15 19:26:44 +01:00
in
{
config = {
2024-12-15 00:29:51 +01:00
home.packages =
(map (
phase:
(pkgs.writeShellScriptBin phase.command ''
switch="/nix/var/nix/profiles/system${
lib.strings.optionalString (phase.specialisation != null) "/specialisation/${phase.specialisation}"
}/bin/switch-to-configuration"
if [ -x "$switch" ]
then
sudo "$switch" test &
sudo "$switch" boot &
fi
${builtins.getAttr phase.command config.frogeye.desktop.phasesCommands}
wait
'')
) phases)
++ (with pkgs; [
2024-06-20 16:47:58 +02:00
brightnessctl
]);
2024-01-15 19:26:44 +01:00
xsession.windowManager.i3.config.keybindings = {
2024-06-20 16:47:58 +02:00
XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
"${mod}+F6" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 1%-";
"${mod}+F7" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +1%";
2024-01-15 19:26:44 +01:00
};
};
}