.dotfiles/configs/waybar/cpu_speed.sh

15 lines
339 B
Bash
Raw Normal View History

2022-01-17 14:48:30 +01:00
#!/bin/bash
class=cpu_speed
speed_mhz=$(lscpu | grep "CPU MHz" | sed --expression "s/CPU MHz:[[:space:]]*//g" | xargs printf "%.*f\n" 0)
2022-04-08 15:47:38 +02:00
2022-01-17 14:48:30 +01:00
# speed_ghz=`echo $(($speed_mhz / 1000))`
speed_ghz=`bc -l <<< "$speed_mhz / 1000"`
info=$(echo $speed_ghz | xargs printf "%.*f\n" 2)
echo -e "{\"text\":\""$info GHz"\", \"class\":\""$class"\"}"