all repos — dotfiles @ 242877a4483e053762fb546c780bbb84f7943155

my *nix dotfiles

bin: cpu freq and temp in bar
Anirudh Oppiliappan x@icyphox.sh
Wed, 27 Apr 2022 12:20:25 +0530
commit

242877a4483e053762fb546c780bbb84f7943155

parent

cc3dd5e1cfeaf649f46ff60e206009b4982b6b25

1 files changed, 10 insertions(+), 1 deletions(-)

jump to
M nix/bin/bar.nixnix/bin/bar.nix

@@ -4,6 +4,7 @@ let

name = "bar"; pamixer = "${pkgs.pamixer}/bin/pamixer"; lemonbar = "${pkgs.lemonbar-xft}/bin/lemonbar"; + cpufreq = "${pkgs.cpufrequtils}/bin/cpufreq-info"; btctl = "${pkgs.bluezFull}/bin/bluetoothctl"; barHeight = if host == "wyndle" then "50" else "30"; in

@@ -17,6 +18,14 @@ vol() {

${pamixer} --get-volume } + freq() { + printf '%sGHz' $(${cpufreq} -fm | cut -d' ' -f1) + } + + temp() { + printf '%sC' $(( $(cat /sys/class/thermal/thermal_zone0/temp) / 1000 )) + } + audio_dev() { con="$(${btctl} info | grep Connected | awk '{ print $2 }')"

@@ -31,7 +40,7 @@ pad="%{015}"

while :; do time="$(date +"%H:%M")" - echo "$pad $(dt) $pad $time %{r}bat $(bat) %{O14}$(audio_dev) $(vol)% $pad" + echo "$pad $(dt) $pad $time %{r}temp $(temp) $pad cpu $(freq) $pad bat $(bat) $pad $(audio_dev) $(vol)% $pad" sleep 0.5 done | ${lemonbar} -n bar -f 'Input:style=Regular:size=12:antialias=true' -g x${barHeight} \ -F '${theme.base00}' -B '${theme.base07}'