aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-doppler
diff options
context:
space:
mode:
authorawy <awy@awy.one>2024-11-28 17:49:11 +0300
committerawy <awy@awy.one>2024-11-28 17:49:11 +0300
commitabeb2dcdf2f2e6ca3ed1836d8cf3d6edf93129f3 (patch)
treeb67df3bfdaeddf4165361899053cb4c74d2681e5 /.local/bin/statusbar/sb-doppler
upload
Diffstat (limited to '.local/bin/statusbar/sb-doppler')
-rwxr-xr-x.local/bin/statusbar/sb-doppler22
1 files changed, 22 insertions, 0 deletions
diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler
new file mode 100755
index 0000000..f673fb3
--- /dev/null
+++ b/.local/bin/statusbar/sb-doppler
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Show a Doppler RADAR of a user's preferred location.
+secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds.
+radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar"
+doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif"
+
+getdoppler() { curl -sL https://meteoinfo.ru/hmc-output/rmap/phenomena.gif > "$doppler" ;}
+
+showdoppler() { setsid -f mpv "$doppler" > /dev/null ;}
+
+case $BLOCK_BUTTON in
+ 1) [ $(($(date '+%s') - $(stat -c %Y "$doppler"))) -gt "$secs" ] && getdoppler
+ showdoppler ;;
+ 2) getdoppler && showdoppler ;;
+ 3) notify-send "πŸ—ΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR.
+- Middle click to update RADAR location.
+After $secs seconds, new clicks will also automatically update the doppler RADAR." ;;
+ 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+echo πŸŒ