Brightness control

This commit is contained in:
marc
2024-12-04 14:33:49 +01:00
parent 2af075c7dd
commit 7fe62ab2ce
3 changed files with 94 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ in
samfelag.modules = {
system.audio.enable = true;
system.brightness.enable = true;
system.kanata.enable = true;
desktop = {

View File

@@ -12,6 +12,10 @@ in
config = mkIf cfg.enable {
# environment.systemPackages = with pkgs; [
# hypridle
# ];
hm.programs.hyprlock = {
enable = true;
settings = {
@@ -37,8 +41,8 @@ in
fade_on_empty = "false";
placeholder_text = "";
outer_color = "rgba(${hexToRGBString config.colorScheme.palette.base02},0.9)";
inner_color = "rgba(${hexToRGBString config.colorScheme.palette.base00},0.9)";
outer_color = "rgba(${hexToRGBString config.colorScheme.palette.base02},1.0)";
inner_color = "rgba(${hexToRGBString config.colorScheme.palette.base00},1.0)";
font_color = "rgba(${hexToRGBString config.colorScheme.palette.base05},1.0)";
check_color = "rgba(${hexToRGBString config.colorScheme.palette.base07},1.0)";
@@ -61,6 +65,51 @@ in
};
};
hm.services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
};
listener = [
{
timeout = 90;
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
{
timeout = 90;
on-timeout = "brightnessctl -sd platform::kbd_backlight set 0"; # turn off keyboard backlight.
on-resume = "brightnessctl -rd platform::kbd_backlight"; # turn on keyboard backlight.
}
{
timeout = 300; # 5min
on-timeout = "loginctl lock-session"; # lock screen when timeout has passed
}
{
timeout = 330; # 5.5min
on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed
on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
}
{
timeout = 1800; # 30min
on-timeout = "systemctl suspend"; # suspend pc
}
];
};
};
# - Execute on startup -----------------------
# hm.wayland.windowManager.hyprland.settings.exec-once = [
# "hypridle"
# ];
};
}