aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-doppler
blob: 75092f3bf814c0a9949e7ae5e7342feb888e8fa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 --no-osc --loop=inf --no-terminal "$doppler" ;}

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 🌅