Commit d2210b9bc1245feee294fbe03ac2e250257a6f50

Thomas de Grivel 2022-04-10T09:02:56

mac m1

diff --git a/.Xdefaults-m1 b/.Xdefaults-m1
new file mode 100644
index 0000000..ca93282
--- /dev/null
+++ b/.Xdefaults-m1
@@ -0,0 +1,8 @@
+! $OpenBSD: dot.Xdefaults,v 1.3 2014/07/10 10:22:59 jasper Exp $
+XTerm*loginShell:true
+XTerm*jumpScroll:true
+XTerm*saveLines:10240
+XTerm*scrollBar:false
+XTerm*faceSize:20
+XTerm*font:CourierNew
+XTerm*faceName:CourierNew
diff --git a/bin/battery-m1 b/bin/battery-m1
new file mode 100755
index 0000000..d793ddb
--- /dev/null
+++ b/bin/battery-m1
@@ -0,0 +1,5 @@
+#!/bin/sh
+MAX="$(sysctl -n hw.sensors.aplsmc0.amphour1 | cut -d ' ' -f 1)"
+POWER="$(sysctl -n hw.sensors.aplsmc0.amphour0 | cut -d ' ' -f 1)"
+PERCENT=$({ echo scale=1; echo "$POWER*100/$MAX"; } | bc)
+echo ${PERCENT}%
diff --git a/bin/nwid-m1 b/bin/nwid-m1
new file mode 100755
index 0000000..59787e3
--- /dev/null
+++ b/bin/nwid-m1
@@ -0,0 +1,2 @@
+#!/bin/sh
+ifconfig bwfm0 | egrep -o 'join [^ ]*' | cut -d\  -f 2
diff --git a/bin/plugged-m1 b/bin/plugged-m1
new file mode 100755
index 0000000..8942c2e
--- /dev/null
+++ b/bin/plugged-m1
@@ -0,0 +1,6 @@
+#!/bin/sh
+if sysctl -n hw.sensors.aplsmc0.indicator0 | grep On >/dev/null; then
+    echo "+"
+else
+    false
+fi
diff --git a/bin/status-m1 b/bin/status-m1
new file mode 100755
index 0000000..844e319
--- /dev/null
+++ b/bin/status-m1
@@ -0,0 +1,2 @@
+#!/bin/sh
+xsetroot -name "$(hostname) $(~/bin/egress_interface) $(~/bin/host-ip) $(~/bin/nwid-m1) $(~/bin/load) $(~/bin/temperature-m1) $(~/bin/battery-m1)$(~/bin/plugged-m1) $(date)"
diff --git a/bin/temperature-m1 b/bin/temperature-m1
new file mode 100755
index 0000000..abe29fd
--- /dev/null
+++ b/bin/temperature-m1
@@ -0,0 +1,8 @@
+#!/bin/sh
+temp() {
+    echo $(sysctl -n $1 | cut -d\  -f 1)°C
+}
+rpm() {
+    echo $(sysctl -n $1 | cut -d\  -f 1)RPM
+}
+echo "$(temp hw.sensors.aplsmc0.temp0) $(temp hw.sensors.aplsmc0.temp1) $(temp hw.sensors.aplsmc0.temp2) $(temp hw.sensors.aplsmc0.temp3) $(rpm hw.sensors.aplsmc0.fan0)"