From dae6ed88b8830c5166a9b525e2b6963e30a97a9f Mon Sep 17 00:00:00 2001
From: Joe <rrbo@proton.me>
Date: Tue, 7 Feb 2023 10:10:00 +0100
Subject: up

---
 .config/conkyrc             |  5 ++---
 .local/bin/conky/weather.sh | 18 ++++++++++++++++++
 .local/bin/tmp_os.sh        |  3 ++-
 3 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100755 .local/bin/conky/weather.sh

diff --git a/.config/conkyrc b/.config/conkyrc
index dcd57a0..038278c 100644
--- a/.config/conkyrc
+++ b/.config/conkyrc
@@ -60,9 +60,8 @@ ${goto 130}${scroll wait 30 3 1 ${mpd_title}}
 ${goto 130}${mpd_elapsed}/${mpd_length} ${mpd_bar}
 ${execi 5 ~/.local/bin/conky/cover.sh >/dev/null 2>&1}${image /tmp/conkyCover.png -p 0,150 -n}${font}
 
-${endif}${if_up enx4ce1734c425a}${font1}WEATHER ${hr}${font}
-${font3}${color #ebdbb2}${alignc}${execi 1800 curl wttr.in/Lyon?T0 --silent --max-time 3}${font}${endif}
-${font1}CPU ${hr}${font}
+${endif}${execpi 1800 ~/.local/bin/conky/weather.sh}
+CPU ${hr}
 ${color #928374}CPU: ${font2}${color #ebdbb2} ${freq_g} GHz ${color #ebdbb2}${cpu}%
 ${offset 4}${cpugraph bfbfbf c0c0c0}
 ${color #928374}1:${color #ebdbb2} ${cpu cpu0}% ${cpubar cpu0}${color #ebdbb2}
diff --git a/.local/bin/conky/weather.sh b/.local/bin/conky/weather.sh
new file mode 100755
index 0000000..273825c
--- /dev/null
+++ b/.local/bin/conky/weather.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+os=$(cat /tmp/os)
+
+case $os in
+	1)
+		ping -c1 -w1 1.1.1.1 >/dev/null 2>&1 || exit
+		;;
+	2)
+		ping -c1 -w1 1.1.1.1 >/dev/null 2>&1 || exit
+		;;
+	3)
+		ping -c1 -t1 1.1.1.1 >/dev/null 2>&1 || exit
+		;;
+esac
+
+echo 'WEATHER ${hr}
+${font2}${color #ebdbb2}${alignc}${exec curl wttr.in/Lyon?T0 --silent --max-time 3}${font}'
diff --git a/.local/bin/tmp_os.sh b/.local/bin/tmp_os.sh
index e0fa13f..ad0be7f 100755
--- a/.local/bin/tmp_os.sh
+++ b/.local/bin/tmp_os.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+tmpfile=/tmp/os
 os="$(uname)"
 
 if [ "$os" = "Linux" ]; then
@@ -10,4 +11,4 @@ else
 	echo "unknown OS"
 	exit 1
 fi
-echo $os >$tmpfile
+echo -n $os >$tmpfile
-- 
cgit v1.2.3