summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2017-07-12 23:37:49 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2017-07-12 23:37:49 +0100
commit3042e43749ed13994d464a56bad9118189f8d7b4 (patch)
treec63523414175bfa7e6f701319cb3a2c6be51ea74
parent020a6ec167dab9641ecebcf79af104cb06b13a0d (diff)
downloadawesome-3042e43749ed13994d464a56bad9118189f8d7b4.tar.gz
Update weather widget config
m---------.config/awesome/lain0
-rw-r--r--.config/awesome/rc.lua30
2 files changed, 18 insertions, 12 deletions
diff --git a/.config/awesome/lain b/.config/awesome/lain
-Subproject 245ab7c33a3261bd2730fdb054e888e31b26f1d
+Subproject 0b72341bbe608726094a48671b680470c7d52db
diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua
index 8b2fdc8..6138c14 100644
--- a/.config/awesome/rc.lua
+++ b/.config/awesome/rc.lua
@@ -257,26 +257,32 @@ vicious.register(pkgwidget, vicious.widgets.pkg, "pkg: $1", 1800, "Debian")
weatherwidget = lain.widget.weather({
city_id = 2964574, -- Dublin, Ireland
units = "metric",
- cnt = 1,
- forecast_call = "curl -s 'http://api.openweathermap.org/data/2.5/forecast?id=%s&units=%s&lang=%s&cnt=%s&APPID=%s'",
notification_preset = {fg = "#FFFFFF",bg = beautiful.bg_normal,position = "bottom_right",font = "dejavu sans mono 8" },
notification_text_fun = function(wn)
- --local day = os.date("%A", wn["dt"])
+ local city = wn["name"]
+ local country = wn["sys"]["country"]
+ local time = os.date("%H:%M",wn["dt"])
+ local srise = os.date("%H:%M",wn["sys"]["sunrise"])
+ local sset = os.date("%H:%M",wn["sys"]["sunset"])
local desc = wn["weather"][1]["description"]
local temp = math.floor(wn["main"]["temp"])
- --local sunrise = tonumber(wn["sys"]["sunrise"])
- local pres = math.floor(wn["main"]["pressure"])
- local humi = math.floor(wn["main"]["humidity"])
- local wspe = math.floor(wn["wind"]["speed"])
- local wdeg = math.floor(wn["wind"]["deg"])
- local clou = math.floor(wn["clouds"]["all"])
local rain3h = 0
- if wn["rain"]["3h"] then
+ if wn["rain"] ~= nil then
rain3h = math.floor(wn["rain"]["3h"])
end
+ local snow3h = 0
+ if wn["snow"] ~= nil then
+ snow3h = math.floor(wn["snow"]["3h"])
+ end
+ preci3h=rain3h+snow3h
+ local wspe = math.floor(wn["wind"]["speed"])
+ local wdeg = math.floor(wn["wind"]["deg"])
+ local humi = math.floor(wn["main"]["humidity"])
+ local pres = math.floor(wn["main"]["pressure"])
+ local clou = math.floor(wn["clouds"]["all"])
- -- format infos as you like, HTML text markup is allowed
- return string.format("%s<br>temperature: %d°C<br>pressure: %dhPa<br>humidity: %d%%<br>wind: %d m/s at %d°<br>cloudliness: %d%%<br>rain: %d mm", desc, temp, pres, humi, wspe, wdeg, clou, rain3h)
+ return string.format("<b>%s,%s @ %s</b><br>sunrise: %s<br>sunset: %s<br><br>%s<br>temperature: %d°C<br>precipitation: %d mm<br>wind: %d m/s at %d°<br>humidity: %d%%<br>pressure: %dhPa<br>cloudiness: %d%%",
+ city, country, time, srise, sset, desc, temp, preci3h, wspe, wdeg, humi, pres, clou)
end,
settings = function()
units = math.floor(weather_now["main"]["temp"])