2024-05-02 15:58:22 -04:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" ''
|
2024-05-05 19:39:36 -04:00
|
|
|
current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
|
2024-05-02 15:58:22 -04:00
|
|
|
|
|
|
|
if [ "$current_profile" == "power-saver" ]; then
|
2024-05-05 19:39:36 -04:00
|
|
|
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set balanced
|
2024-05-02 15:58:22 -04:00
|
|
|
elif [ "$current_profile" == "balanced" ]; then
|
2024-05-05 19:39:36 -04:00
|
|
|
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set performance
|
2024-05-02 15:58:22 -04:00
|
|
|
elif [ "$current_profile" == "performance" ]; then
|
2024-05-05 19:39:36 -04:00
|
|
|
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set power-saver
|
2024-05-02 15:58:22 -04:00
|
|
|
fi
|
|
|
|
|
2024-05-05 19:39:36 -04:00
|
|
|
new_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
|
|
|
|
${lib.getExe pkgs.libnotify} "Power profile set to $new_profile."
|
2024-05-02 15:58:22 -04:00
|
|
|
'';
|
|
|
|
in {
|
2024-06-26 22:13:02 -04:00
|
|
|
config = lib.mkIf config.ar.home.scripts.pp-adjuster.enable {
|
2024-05-02 15:58:22 -04:00
|
|
|
home.packages = [pp-adjuster];
|
|
|
|
};
|
|
|
|
}
|