aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2020-03-23 23:50:05 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2020-03-23 23:50:05 +0100
commite89978b6c45c6229c6341c1dbf9c28b7ba254a77 (patch)
treeef63846896b9faf8f4ddc123bec32b4e4c82f498
parent384a2b36c86be5e79913a1861d8eb23ec3bf65cb (diff)
downloadscripts-e89978b6c45c6229c6341c1dbf9c28b7ba254a77.tar.gz
scripts-e89978b6c45c6229c6341c1dbf9c28b7ba254a77.zip
Coronavirus Spain daily status script for i3blocks.
-rwxr-xr-xi3blocks/i3corona.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/i3blocks/i3corona.sh b/i3blocks/i3corona.sh
new file mode 100755
index 0000000..8874f7f
--- /dev/null
+++ b/i3blocks/i3corona.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# i3corona.sh
+#
+# Shows daily stats about coronavirus in Spain
+
+#case $BLOCK_BUTTON in
+# 1) # Left click
+# 2) # Middle click
+# 3) # Right click
+#esac
+
+tmpDir="/tmp/corona"
+tmpFile="${tmpDir}/coronaData.txt"
+
+[ -d "$tmpDir" ] || mkdir -p "$tmpDir"
+[ -f "$tmpFile" ] ||
+ curl https://corona-stats.online/spain > "$tmpFile" 2>/dev/null
+
+grep 'Spain' "$tmpFile" | sed 's/\s*//g; s/\x1b\[[0-9;]*m//g; s/[,▲]//g' |
+ awk -F'│' '{print "😷 " $3 " (+" $9 ") 💪 " $8 "%"}'
+