style: Split out and fixes
This commit is contained in:
parent
1b008c1ae8
commit
43e7a5af46
13 changed files with 111 additions and 91 deletions
36
hm/brightness/default.nix
Normal file
36
hm/brightness/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Light theme during the day, dark theme during the night (not automatic)
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
phases = [
|
||||
{ command = "jour"; polarity = "light"; }
|
||||
{ command = "crepuscule"; polarity = "dark"; }
|
||||
{ command = "nuit"; polarity = "dark"; }
|
||||
];
|
||||
phasesBrightness = config.frogeye.desktop.phasesBrightness;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
home.packages = map
|
||||
(phase: (pkgs.writeShellApplication {
|
||||
name = "${phase.command}";
|
||||
runtimeInputs = [ pkgs.brightnessctl ];
|
||||
text = (lib.optionalString phasesBrightness.enable ''
|
||||
brightnessctl set ${builtins.getAttr phase.command phasesBrightness}
|
||||
'') + ''
|
||||
switch="/nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration"
|
||||
if [ -x "$switch" ]
|
||||
then
|
||||
# In two steps to get the visual changes slightly earlier
|
||||
sudo "$switch" test
|
||||
sudo "$switch" boot
|
||||
fi
|
||||
'';
|
||||
})
|
||||
)
|
||||
phases;
|
||||
xsession.windowManager.i3.config.keybindings = {
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue