weather_status.lua

 1-- weather_status.lua
 2-- Fetches current weather and displays it in the inbox status bar.
 3-- Uses the free wttr.in API (no API key required).
 4
 5local matcha = require("matcha")
 6
 7local CITY = "London"
 8
 9matcha.on("startup", function()
10    local res, err = matcha.http({
11        url = "https://wttr.in/" .. CITY .. "?format=%t+%C",
12    })
13
14    if err then
15        matcha.log("weather: " .. err)
16        return
17    end
18
19    if res.status == 200 then
20        matcha.set_status("inbox", res.body)
21    end
22end)