(defpoll weather :interval "30m" :default `curl 'https://api.open-meteo.com/v1/forecast?latitude=37.98&longitude=23.73¤t_weather=true'` `curl 'https://api.open-meteo.com/v1/forecast?latitude=37.98&longitude=23.73¤t_weather=true'`) (defwidget weather-widget[] (weather-widget-h)) (defwidget weather-widget-v[] (box :class "weather widget" :orientation "vertical" (weather-type) (temp))) (defwidget weather-widget-h[] (box :class "weather" :orientation "horizontal" :space-evenly false (weather-type) (temp))) (defwidget temp[] (label :text "${weather.current_weather.temperature}°C")) ;; https://open-meteo.com/en/docs ;; 0 Clear sky ;; 1, 2, 3 Mainly clear, partly cloudy, and overcast ;; 45, 48 Fog and depositing rime fog ;; 51, 53, 55 Drizzle: Light, moderate, and dense intensity ;; 56, 57 Freezing Drizzle: Light and dense intensity ;; 61, 63, 65 Rain: Slight, moderate and heavy intensity ;; 66, 67 Freezing Rain: Light and heavy intensity ;; 71, 73, 75 Snow fall: Slight, moderate, and heavy intensity ;; 77 Snow grains ;; 80, 81, 82 Rain showers: Slight, moderate, and violent ;; 85, 86 Snow showers slight and heavy ;; 95 * Thunderstorm: Slight or moderate ;; 96, 99 * Thunderstorm with slight and heavy hail (defwidget weather-type[] (label :class "weather-icon" :text {weather.current_weather.weathercode == 1 ? "󰖙" : weather.current_weather.weathercode < 4 ? "󰖕" : weather.current_weather.weathercode == 45 || weather.current_weather.weathercode == 48 ? "󰖑" : weather.current_weather.weathercode == 51 || weather.current_weather.weathercode == 53 || weather.current_weather.weathercode == 55 || weather.current_weather.weathercode == 56 || weather.current_weather.weathercode == 57 ? "󰼳" : weather.current_weather.weathercode == 61 || weather.current_weather.weathercode == 63 || weather.current_weather.weathercode == 65 || weather.current_weather.weathercode == 66 || weather.current_weather.weathercode == 67 ? "󰖗" : weather.current_weather.weathercode == 71 || weather.current_weather.weathercode == 73 || weather.current_weather.weathercode == 75 || weather.current_weather.weathercode == 77 ? "󰖘" : weather.current_weather.weathercode == 80 || weather.current_weather.weathercode == 81 || weather.current_weather.weathercode == 82 ? "󰖖" : weather.current_weather.weathercode == 85 || weather.current_weather.weathercode == 86 ? "󰼶": weather.current_weather.weathercode == 95 || weather.current_weather.weathercode == 96 || weather.current_weather.weathercode == 99 ? "󰖓" : "err: ${weather.current_weather.weathercode}"}))