-- Now: the current conditions. Replaces the OpenWeatherMap weather card; the -- daylight arc it carried moved to the sky card. -- -- One of the forecast cards adapted from the Conky-Mirage theme by -- alexsson-xexpanderx (see lib/weather.lua). local card = require 'lib.card' local data = require 'lib.data' local weather = require 'lib.weather' local M = {} function M.draw(cr, rect, colors) local inner = card.card(cr, rect, colors) local w = weather.parse(data.slurp(weather.CACHE)) if not w then card.notice(cr, inner, colors, 'WEATHER', 'no weather data', 'bin/weather-fetch.sh') return end local c, today, now = w.current, w.days[1] or {}, os.time() local rows = { { 'FEELS LIKE', weather.deg(c.feels) }, { 'HIGH / LOW', weather.deg(today.max) .. ' / ' .. weather.deg(today.min) }, { 'RAIN', weather.num(today.precip, '%') }, { 'UPDATED', weather.age_str(c.dt, now), weather.is_stale(c.dt, now) and colors.warning or nil }, } -- No title: the condition glyph stands in for it, at the big value's size. card.standard(cr, inner, colors, { icon = weather.icon(c.code, c.is_day), big = weather.deg(c.temp), rows = rows, share = 0.85, }) end return M