phases: Allow loosen brightness setting again

Didn't manage to do what I wanted to do for some reason, but hey,
at least ddcutils is there.
This commit is contained in:
Geoffrey Frogeye 2024-06-10 03:00:52 +02:00
parent d5917b1264
commit 865bffa641
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
5 changed files with 42 additions and 32 deletions

View file

@ -6,27 +6,19 @@ let
{ command = "crepuscule"; specialisation = "dark"; }
{ command = "nuit"; specialisation = "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${lib.strings.optionalString (phase.specialisation != null) "/specialisation/${phase.specialisation}"}/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
'';
})
)
(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}
''))
phases;
xsession.windowManager.i3.config.keybindings = {
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";