main
 1{lib, ...} @ topArgs: {
 2  flake.modules.homeManager.de-plasma6 = {osConfig}: let
 3    hostMeta = topArgs.config.flake.meta.host.hosts.${osConfig.networking.hostName};
 4  in {
 5    # AC is compatible for all hosts
 6    programs.plasma.powerdevil = {
 7      AC = {
 8        powerProfile = "performance";
 9        # Auto Power Save
10        autoSuspend.action = "nothing";
11        turnOffDisplay = {
12          idleTimeout = 14400;
13          idleTimeoutWhenLocked = 600;
14        };
15        dimDisplay.enable = false;
16        # Actions
17        whenLaptopLidClosed = "sleep";
18        whenSleepingEnter = "standby";
19        powerButtonAction = "hibernate";
20        inhibitLidActionWhenExternalMonitorConnected = lib.mkIf hostMeta.isLaptop true;
21      };
22
23      battery = lib.mkIf hostMeta.isLaptop {
24        powerProfile = "powerSaving";
25        # Auto Power Save
26        autoSuspend = {
27          action = "sleep";
28          idleTimeout = 600;
29        };
30        turnOffDisplay = {
31          idleTimeout = 360;
32          idleTimeoutWhenLocked = 120;
33        };
34        dimDisplay = {
35          enable = true;
36          idleTimeout = 120;
37        };
38        # Actions
39        whenLaptopLidClosed = "hibernate";
40        whenSleepingEnter = "standbyThenHibernate";
41        powerButtonAction = "shutDown";
42        inhibitLidActionWhenExternalMonitorConnected = true;
43      };
44      lowBattery = lib.mkIf hostMeta.isLaptop {
45        powerProfile = "powerSaving";
46        # Auto Power Save
47        autoSuspend = {
48          action = "sleep";
49          idleTimeout = 300;
50        };
51        turnOffDisplay = {
52          idleTimeout = 180;
53          idleTimeoutWhenLocked = 60;
54        };
55        dimDisplay = {
56          enable = true;
57          idleTimeout = 60;
58        };
59        # Actions
60        whenLaptopLidClosed = "hibernate";
61        whenSleepingEnter = "standbyThenHibernate";
62        powerButtonAction = "shutDown";
63        inhibitLidActionWhenExternalMonitorConnected = true;
64      };
65    };
66  };
67}