16 lines
701 B
Nix
16 lines
701 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
# Udev rules for battery optimizations
|
|
services.udev.extraRules = ''
|
|
# Reduce brightness to 40% when switching to battery
|
|
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="${pkgs.light}/bin/light -S 40"
|
|
|
|
# AMD GPU power management - force battery profile when unplugged
|
|
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="${pkgs.bash}/bin/bash -c 'echo battery > /sys/class/drm/card*/device/power_dpm_force_performance_level'"
|
|
|
|
# AMD GPU power management - auto when plugged in
|
|
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="${pkgs.bash}/bin/bash -c 'echo auto > /sys/class/drm/card*/device/power_dpm_force_performance_level'"
|
|
'';
|
|
}
|