aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2020-12-15 15:45:09 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2020-12-15 15:45:09 -0500
commit3f705fd9ff7b937a077231a65ba7888096303816 (patch)
tree60fd4b25a60a49cd1820690c65fc07b66522b637
parent619cb6070d87a619f0a9586bb4ff98a4cdfcef67 (diff)
downloaddotfiles-3f705fd9ff7b937a077231a65ba7888096303816.tar.gz
dotfiles-3f705fd9ff7b937a077231a65ba7888096303816.tar.xz
Tweak my status bar a bit.
-rwxr-xr-xbin/status-bar41
1 files changed, 30 insertions, 11 deletions
diff --git a/bin/status-bar b/bin/status-bar
index 1a537f6..7a82c9a 100755
--- a/bin/status-bar
+++ b/bin/status-bar
@@ -1,5 +1,5 @@
#!/bin/sh
-timeout=5
+timeout=61
_sys_memory() {
free -m | awk '/^Mem/{print $6;exit 0;}'
@@ -45,7 +45,8 @@ network_info() {
batt_status() {
- sudo tlp-stat -b | awk 'BEGIN{ORS=" "} /\/status/{print $3}/^Charge/{print $3}';
+ # sudo tlp-stat -b | awk 'BEGIN{ORS=" "} /\/status/{print $3}/^Charge/{print $3}';
+ cat /sys/class/power_supply/BAT0/capacity
}
cpu_freq() {
@@ -59,23 +60,40 @@ cpu_freq() {
# | sed -n -e 1p -e '$p' \
# | awk '{printf("%0.2f ", $4/1000)} END{print ""}'
# Just show the first four CPUs
+# grep '^cpu MHz' /proc/cpuinfo \
+# | awk '{printf("%0.1f\n", $4/1000)}' \
+# | sort \
+# | uniq \
+# | sort -rn \
+# | sed 4q \
+# | tr '\n' ' '
+#
grep '^cpu MHz' /proc/cpuinfo \
- | awk '{printf("%0.1f\n", $4/1000)}' \
- | sort \
- | uniq \
- | sort -rn \
- | sed 4q \
- | tr '\n' ' '
+| awk '{
+ average = average + $4;
+ counter = counter + 1
+} END {
+ printf("%0.1f\n", (average/counter)/1000)
+}'
}
tlp_status() {
tlp-stat -s | sed -n 's/^Mode *= //p'
}
+_fan() {
+ sensors | sed -n 's/^fan1:[\t ]*//p'
+}
+
+k10Temp() {
+sensors | sed -n '/^k10/,/^$/p' | awk '/^Tctl/{print $2}' \
+ | sed -e's/+//g' -e's/\.[0-9][^0-9]*$//g'
+}
+
status_line() {
echo \
"Temp: $(sensors | sed -n 's/^temp1:[\t ]*//p' | sed 's/ *//g' | sed 1q | tr -d '\n')|"\
-"Fan: $(sensors | sed -n 's/^fan1:[\t ]*//p')|"\
+"Fan: $(_fan)|"\
"Cpu Freq: $(cpu_freq)mhz|"\
"Batt: $(batt_status)|"\
"$(network_info)|"\
@@ -101,11 +119,12 @@ echo \
t495_status_line() {
echo \
+"Fan: $(_fan)|"\
+"Temp: $(k10Temp)|"\
"CPU: $(cpu_freq)|"\
-"TLP: $(tlp_status)|"\
"Batt: $(batt_status | sed -e's/ *$//g')|"\
"$(network_info)|"\
-"$(date '+%m.%d.%Y %H:%M:%S')"
+"$(date '+%m.%d.%Y %H:%M')"
}
_type="$1"; shift