dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit dfb33a9d4fa4345f6859d1f54053ace4f070e58f
parent 774955ac6c684fd1208943485d1a543274db7033
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 16 Aug 2019 10:00:19 +0200

Read CPU temperature with `sensors` command

Diffstat:
M.local/bin/sysstatus | 18++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/.local/bin/sysstatus b/.local/bin/sysstatus @@ -6,21 +6,23 @@ mail=$(mailstatus | sed 's/^/ /;s/$/ |/;s/ |//') music=$(mpc status | sed 1q | sed 's/^volume:.*$//;s/^/ /;s/$/ |/;s/ |//') keymap=$(setxkbmap -print | sed -n '5s/^.*pc+//;5s/+.*$//;5p') vol=$(pulsemixer --get-volume | cut -d' ' -f1) -cputemp=$(sed 's/[0-9][0-9][0-9]$//' /sys/class/thermal/thermal_zone0/temp) +cputemp=$(sensors | grep -n 'Core 0:' | awk '{print $3}') cpuload=$(cut -d' ' -f1 /proc/loadavg) -batstatus=$(sed -n 's/Charging/+/;s/Discharging/-/' \ - /sys/class/power_supply/${battery}/status | sed 's/Unknown//') -batlvl=$(cat /sys/class/power_supply/${battery}/capacity) -batremain=$(acpi -b | sed 1q |\ - sed -n 's/.*\([0-9][0-9]:[0-9][0-9]\):[0-9][0-9].*$/\1/p') -battery="$(echo "${batstatus}${batlvl}% ${batremain}" | sed 's/ $//')" +if [ -d "/sys/class/power_supply/$battery" ]; then + batstatus=$(sed -n 's/Charging/+/;s/Discharging/-/' \ + /sys/class/power_supply/${battery}/status | sed 's/Unknown//') + batlvl=$(cat /sys/class/power_supply/${battery}/capacity) + batremain=$(acpi -b | sed 1q |\ + sed -n 's/.*\([0-9][0-9]:[0-9][0-9]\):[0-9][0-9].*$/\1/p') + battery="$(echo "${batstatus}${batlvl}% ${batremain}" | sed 's/ $//')" +fi wlanssid=$(iwgetid -r $wlandev) wlanquality=$(echo \ "0$(grep $wlandev /proc/net/wireless | awk '{print $3}')/70 * 100" |\ bc -l | sed 's/\..*$//') date=$(date +'%F %a %T') -status="${mail}${music} ${keymap} | ♪ ${vol}% | ${cputemp}°C ${cpuload} |\ +status="${mail}${music} ${keymap} | ♪ ${vol}% | ${cputemp} ${cpuload} |\ ${battery} | ${wlanssid} ${wlanquality}% | $date" printf "%s" "$status"