{
  pkgs,
  inputs,
  username,
  project,
  powerProfile,
  ...
}: let
  profiles = {
    laptop = {
      AC.powerProfile = "powerSaving";
      battery.powerProfile = "powerSaving";
      lowBattery.powerProfile = "powerSaving";
    };
    desktop = {
      AC.powerProfile = "performance";
      battery.powerProfile = "performance";
      lowBattery.powerProfile = "performance";
    };
  };

  selectedProfile = profiles.${powerProfile};
in {
  programs = {
    plasma = {
      overrideConfig = true;

      powerdevil = {
        AC = {
          powerProfile = selectedProfile.AC.powerProfile;
          autoSuspend = {
            action = "nothing";
          };
          dimDisplay.enable = false;
          turnOffDisplay.idleTimeout = "never";
        };

        battery = {
          powerProfile = selectedProfile.battery.powerProfile;
          autoSuspend = {
            action = "nothing";
          };
          whenLaptopLidClosed = "sleep";
          dimDisplay.enable = false;
          turnOffDisplay.idleTimeout = "never";
        };

        lowBattery = {
          powerProfile = selectedProfile.lowBattery.powerProfile;
          autoSuspend = {
            action = "sleep";
            idleTimeout = 300;
          };
          whenLaptopLidClosed = "sleep";
          dimDisplay = {
            idleTimeout = 60;
          };
          displayBrightness = 30;
          turnOffDisplay.idleTimeout = 120;
        };

        batteryLevels = {
          lowLevel = 10;
          criticalLevel = 5;
          criticalAction = "sleep";
        };
      };
    };
  };
}
