From 68e90ed5ddea8cbd801ca6a6e6cfeba052a71528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Tue, 22 Oct 2019 16:52:31 +0100 Subject: [PATCH] calculate max cpu temp no matter how many temp zones --- cpu-temp.sh | 9 +++++++++ nixos/home.nix | 2 +- nixos/polybar.nix | 5 ++--- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 cpu-temp.sh diff --git a/cpu-temp.sh b/cpu-temp.sh new file mode 100755 index 00000000..c7c80523 --- /dev/null +++ b/cpu-temp.sh @@ -0,0 +1,9 @@ +#!/bin/sh +profile="$HOME/.nix-profile/bin/" +system="/run/current-system/sw/bin/" + +sensors="$profile/sensors" + +max_temp=`$sensors | $system/egrep -o '[0-9][0-9]\.[0-9]' | $system/sort | $system/uniq | $system/tail -n 1` + +echo "${max_temp}°C" diff --git a/nixos/home.nix b/nixos/home.nix index 34d5a8ba..2aecffce 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -14,7 +14,7 @@ in }; }; home.packages = with pkgs; [ - cabal-install stack hsetroot + cabal-install stack hsetroot lm_sensors wirelesstools ranger xpdf apvlv unstable.xidlehook blueman fontconfig nodejs rustup gcc gdb binutils xclip pkgconfig veracrypt gitAndTools.diff-so-fancy diff --git a/nixos/polybar.nix b/nixos/polybar.nix index 663964b3..e725ab3f 100644 --- a/nixos/polybar.nix +++ b/nixos/polybar.nix @@ -56,10 +56,9 @@ }; "module/temperature" = { - type = "internal/temperature"; - thermal-zone = 3; + type = "custom/script"; interval = 5; - format = "TEMP: