Add CPU temperature module to polybar

inky
Elnu 2 years ago
parent b9b2977406
commit f554a9038b

@ -8,7 +8,7 @@
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" "coretemp" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
hardware.enableAllFirmware = true; hardware.enableAllFirmware = true;

@ -13,6 +13,7 @@ in
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.callPackage ./aozora.nix { }) (pkgs.callPackage ./aozora.nix { })
(pkgs.callPackage ./polybar-now-playing.nix { }) (pkgs.callPackage ./polybar-now-playing.nix { })
lm_sensors
]; ];
services.polybar = { services.polybar = {
enable = true; enable = true;
@ -50,6 +51,7 @@ in
"pulseaudio" "pulseaudio"
"memory" "memory"
"cpu" "cpu"
"cputemp"
"battery" "battery"
"date" "date"
]; ];
@ -123,6 +125,13 @@ in
format-prefix = "CPU "; format-prefix = "CPU ";
format-prefix-foreground = "${primary}"; format-prefix-foreground = "${primary}";
}; };
"module/cputemp" = {
type = "custom/script";
interval = 2;
exec = "/etc/profiles/per-user/elnu/bin/sensors | /run/current-system/sw/bin/grep \"Package id 0:\" | /run/current-system/sw/bin/tr -d '+' | /run/current-system/sw/bin/awk '{print $4}'";
};
# TODO: Only build battery module on ThinkPad host # TODO: Only build battery module on ThinkPad host
"module/battery" = { "module/battery" = {
type = "internal/battery"; type = "internal/battery";
@ -132,7 +141,8 @@ in
format-low = "<animation-low> <label-low>"; format-low = "<animation-low> <label-low>";
label-charging = "%{F${primary}}AC%{F-} %percentage%%"; label-charging = "%{F${primary}}AC%{F-} %percentage%%";
label-discharging = "%{F${primary}}BAT%{F-} %percentage%%"; label-full = "%{F${primary}}AC%{F-}"; label-discharging = "%{F${primary}}BAT%{F-} %percentage%%";
label-full = "%{F${primary}}AC%{F-}";
animation-low-0 = "%{F${primary}}BAT%{F-}"; animation-low-0 = "%{F${primary}}BAT%{F-}";
animation-low-1 = "%{F${alert}}LOW%{F-}"; animation-low-1 = "%{F${alert}}LOW%{F-}";

Loading…
Cancel
Save