14 lines
635 B
Bash
Executable File
14 lines
635 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Open the hourly weather forecast (wttr.in v2 view) in a ghostty window;
|
|
# focus it if it is already open. Intended as the on-click action for the
|
|
# waybar weather module.
|
|
set -uo pipefail
|
|
|
|
if hyprctl clients -j 2>/dev/null | jq -e 'any(.[]; ((.title // "") + " " + (.class // "")) | ascii_downcase | contains("wttr"))' >/dev/null 2>&1; then
|
|
hyprctl dispatch 'hl.dsp.focus({ window = "title:wttr" })' 2>/dev/null || true
|
|
exit 0
|
|
fi
|
|
|
|
CITY="${WEATHER_CITY:-Denver}"
|
|
ghostty --title=wttr -e bash -c 'curl -fsS --max-time 15 "https://v2.wttr.in/'"${CITY}"'"; printf "\n"; read -r -p "Press Enter to close"' &
|
|
disown |