Commit a200ea59ab917e32acf89ef49efef589f1df3d4d

Thomas de Grivel 2021-02-20T15:53:07

x240

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/bin/battery-x240 b/bin/battery-x240
new file mode 100755
index 0000000..9f94af3
--- /dev/null
+++ b/bin/battery-x240
@@ -0,0 +1,5 @@
+#!/bin/sh
+MAX="$(sysctl -n hw.sensors.acpibat1.watthour0 | cut -d ' ' -f 1)"
+POWER="$(sysctl -n hw.sensors.acpibat1.watthour3 | cut -d ' ' -f 1)"
+PERCENT=$({ echo scale=1; echo "$POWER*100/$MAX"; } | bc) 
+echo ${PERCENT}%
diff --git a/bin/temperature-x240 b/bin/temperature-x240
new file mode 100755
index 0000000..1ce9f40
--- /dev/null
+++ b/bin/temperature-x240
@@ -0,0 +1,4 @@
+#!/bin/sh
+CPUTEMP=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d\  -f 1)
+MBTEMP=$(sysctl -n hw.sensors.acpithinkpad0.temp0 | cut -d\  -f 1)
+echo "${CPUTEMP}°C ${MBTEMP}°C"