gihcomit
This commit is contained in:
51
config/modules/power-management/tdp.nix
Normal file
51
config/modules/power-management/tdp.nix
Normal file
@@ -0,0 +1,51 @@
|
||||
{ modules, den, ... }:
|
||||
{
|
||||
modules.tdp = settings: {
|
||||
nixos =
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
batt-tdp = pkgs.writeShellScript "batt-cpu-tdp" ''
|
||||
${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${
|
||||
toString (settings.batt.cpu.long-term * 1000000)
|
||||
}
|
||||
${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${
|
||||
toString (settings.batt.cpu.short-term * 1000000)
|
||||
}
|
||||
'';
|
||||
ac-tdp = pkgs.writeShellScript "ac-cpu-tdp" ''
|
||||
${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${
|
||||
toString (settings.ac.cpu.long-term * 1000000)
|
||||
}
|
||||
${pkgs.powercap}/bin/powercap-set intel-rapl -z 0 -c 0 -l ${
|
||||
toString (settings.ac.cpu.short-term * 1000000)
|
||||
}
|
||||
'';
|
||||
in
|
||||
{
|
||||
systemd.services.tdp-on-batt = {
|
||||
enable = true;
|
||||
before = [ "battery.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${batt-tdp}";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
wantedBy = [ "battery.target" ];
|
||||
partOf = [ "battery.target" ];
|
||||
};
|
||||
systemd.services.tdp-on-ac = {
|
||||
enable = true;
|
||||
before = [ "ac.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${ac-tdp}";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
wantedBy = [ "ac.target" ];
|
||||
partOf = [ "ac.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -26,7 +26,7 @@ Item {
|
||||
name: "FOCUSED"
|
||||
PropertyChanges {
|
||||
target: content
|
||||
width: 10
|
||||
implicitWidth: 10
|
||||
scale: 1
|
||||
}
|
||||
},
|
||||
@@ -34,7 +34,7 @@ Item {
|
||||
name: "EXISTS"
|
||||
PropertyChanges {
|
||||
target: content
|
||||
width: 10
|
||||
implicitWidth: 10
|
||||
scale: 0.85
|
||||
}
|
||||
},
|
||||
@@ -42,15 +42,15 @@ Item {
|
||||
name: "NOT"
|
||||
PropertyChanges {
|
||||
target: content
|
||||
width: 10
|
||||
implicitWidth: 10
|
||||
scale: 0.75
|
||||
}
|
||||
}
|
||||
]
|
||||
height: 15
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
radius: 2.5
|
||||
color: {
|
||||
if (HyprlandHelpers.getHyprlandWorkspaceById(index + 1) != null) {
|
||||
|
||||
Reference in New Issue
Block a user