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:
parent
d5917b1264
commit
865bffa641
|
@ -44,11 +44,23 @@ in
|
||||||
];
|
];
|
||||||
maxVideoHeight = 1440;
|
maxVideoHeight = 1440;
|
||||||
numlock = true;
|
numlock = true;
|
||||||
phasesBrightness = {
|
phasesCommands = {
|
||||||
enable = true;
|
jour = ''
|
||||||
jour = "40000";
|
${pkgs.brightnessctl}/bin/brightnessctl set 40000 &
|
||||||
crepuscule = "10000";
|
${pkgs.ddcutil}/bin/ddcutil setvcp 10 20 -d 1 &
|
||||||
nuit = "1";
|
${pkgs.ddcutil}/bin/ddcutil setvcp 10 20 -d 2 &
|
||||||
|
'';
|
||||||
|
crepuscule = ''
|
||||||
|
${pkgs.brightnessctl}/bin/brightnessctl set 10000 &
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil setvcp 10 10 -d 1 &
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil setvcp 10 10 -d 2 &
|
||||||
|
'';
|
||||||
|
nuit = ''
|
||||||
|
${pkgs.brightnessctl}/bin/brightnessctl set 1 &
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil setvcp 10 0 -d 1 &
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil setvcp 10 0 -d 2 &
|
||||||
|
'';
|
||||||
|
# TODO Display 2 doesn't work anymore?
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
|
|
|
@ -6,27 +6,19 @@ let
|
||||||
{ command = "crepuscule"; specialisation = "dark"; }
|
{ command = "crepuscule"; specialisation = "dark"; }
|
||||||
{ command = "nuit"; specialisation = "dark"; }
|
{ command = "nuit"; specialisation = "dark"; }
|
||||||
];
|
];
|
||||||
phasesBrightness = config.frogeye.desktop.phasesBrightness;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
home.packages = map
|
home.packages = map
|
||||||
(phase: (pkgs.writeShellApplication {
|
(phase: (pkgs.writeShellScriptBin phase.command ''
|
||||||
name = "${phase.command}";
|
switch="/nix/var/nix/profiles/system${lib.strings.optionalString (phase.specialisation != null) "/specialisation/${phase.specialisation}"}/bin/switch-to-configuration"
|
||||||
runtimeInputs = [ pkgs.brightnessctl ];
|
if [ -x "$switch" ]
|
||||||
text = (lib.optionalString phasesBrightness.enable ''
|
then
|
||||||
brightnessctl set ${builtins.getAttr phase.command phasesBrightness}
|
sudo "$switch" test &
|
||||||
'') + ''
|
sudo "$switch" boot &
|
||||||
switch="/nix/var/nix/profiles/system${lib.strings.optionalString (phase.specialisation != null) "/specialisation/${phase.specialisation}"}/bin/switch-to-configuration"
|
fi
|
||||||
if [ -x "$switch" ]
|
${builtins.getAttr phase.command config.frogeye.desktop.phasesCommands}
|
||||||
then
|
''))
|
||||||
# In two steps to get the visual changes slightly earlier
|
|
||||||
sudo "$switch" test
|
|
||||||
sudo "$switch" boot
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
)
|
|
||||||
phases;
|
phases;
|
||||||
xsession.windowManager.i3.config.keybindings = {
|
xsession.windowManager.i3.config.keybindings = {
|
||||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
||||||
|
|
|
@ -22,11 +22,10 @@
|
||||||
description = "Maximum video height in pixel the machine can reasonably watch";
|
description = "Maximum video height in pixel the machine can reasonably watch";
|
||||||
default = 1080;
|
default = 1080;
|
||||||
};
|
};
|
||||||
phasesBrightness = {
|
phasesCommands = {
|
||||||
enable = lib.mkEnableOption "Set a specific brightness for the screen when running phases commands";
|
jour = lib.mkOption { type = lib.types.lines; default = ""; description = "Command to execute for phase: jour"; };
|
||||||
jour = lib.mkOption { type = lib.types.str; default = "100%"; description = "brightnessctl value for phase: jour"; };
|
crepuscule = lib.mkOption { type = lib.types.lines; default = ""; description = "Command to execute for phase: crepuscule"; };
|
||||||
crepuscule = lib.mkOption { type = lib.types.str; default = "50%"; description = "brightnessctl value for phase: crepuscule"; };
|
nuit = lib.mkOption { type = lib.types.lines; default = ""; description = "Command to execute for phase: nuit"; };
|
||||||
nuit = lib.mkOption { type = lib.types.str; default = "1%"; description = "brightnessctl value for phase: nuit"; };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
dev = {
|
dev = {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.frogeye.desktop.xorg {
|
config = lib.mkIf config.frogeye.desktop.xorg {
|
||||||
|
boot.kernelModules = [ "i2c-dev" ]; # Allows using ddcutil
|
||||||
services = {
|
services = {
|
||||||
blueman.enable = true;
|
blueman.enable = true;
|
||||||
displayManager.defaultSession = "none+i3";
|
displayManager.defaultSession = "none+i3";
|
||||||
|
udev.packages = with pkgs; [ ddcutil ]; # TODO Doesn't seem to help
|
||||||
xserver = {
|
xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
windowManager.i3.enable = true;
|
windowManager.i3.enable = true;
|
||||||
|
|
|
@ -16,11 +16,16 @@
|
||||||
frogeye.desktop = {
|
frogeye.desktop = {
|
||||||
x11_screens = [ "DP-1" "eDP-1" ];
|
x11_screens = [ "DP-1" "eDP-1" ];
|
||||||
maxVideoHeight = 1080;
|
maxVideoHeight = 1080;
|
||||||
phasesBrightness = {
|
phasesCommands = {
|
||||||
enable = true;
|
jour = ''
|
||||||
jour = "3500";
|
${pkgs.brightnessctl}/bin/brightnessctl set 3500
|
||||||
crepuscule = "3000";
|
'';
|
||||||
nuit = "700";
|
crepuscule = ''
|
||||||
|
${pkgs.brightnessctl}/bin/brightnessctl set 3000
|
||||||
|
'';
|
||||||
|
nuit = ''
|
||||||
|
${pkgs.brightnessctl}/bin/brightnessctl set 700
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue