summaryrefslogtreecommitdiff
path: root/weather-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2020-12-02 09:18:16 -0500
committerstreetturtle <streetturtle@gmail.com>2020-12-02 09:18:16 -0500
commit8be78d4fddfc2c88352b25f5d8d89c6dc14df37c (patch)
tree68f14b1e9d1e6265bc95e1fa39f06e439bc79572 /weather-widget
parentbc7008458e90edbf4a48a3356433c8b96b850335 (diff)
fix few issues
Diffstat (limited to 'weather-widget')
-rw-r--r--weather-widget/weather.lua16
1 files changed, 6 insertions, 10 deletions
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua
index 0317746..681e122 100644
--- a/weather-widget/weather.lua
+++ b/weather-widget/weather.lua
@@ -27,7 +27,6 @@ end
local weather_widget = {}
local warning_shown = false
-local notification
local tooltip = awful.tooltip {
mode = 'outside',
preferred_positions = {'bottom'}
@@ -115,9 +114,9 @@ local function uvi_index_color(uvi)
return '<span weight="bold" foreground="' .. color .. '">' .. uvi .. '</span>'
end
-local function worker(args)
+local function worker(user_args)
- local args = args or {}
+ local args = user_args or {}
--- Validate required parameters
if args.coordinates == nil or args.api_key == nil then
@@ -384,7 +383,7 @@ local function worker(args)
hourly_forecast_negative_graph:set_max_value(math.abs(min_temp))
hourly_forecast_negative_graph:set_min_value(max_temp < 0 and math.abs(max_temp) * 0.7 or 0)
- for i, value in ipairs(values) do
+ for _, value in ipairs(values) do
if value >= 0 then
hourly_forecast_graph:add_value(value)
hourly_forecast_negative_graph:add_value(0)
@@ -470,12 +469,9 @@ local function worker(args)
local function update_widget(widget, stdout, stderr)
if stderr ~= '' then
if not warning_shown then
- if (
- stderr ~= 'curl: (52) Empty reply from server' and
- stderr ~= 'curl: (28) Failed to connect to api.openweathermap.org port 443: Connection timed out' and
- stderr:find(
- '^curl: %(18%) transfer closed with %d+ bytes remaining to read$'
- ) ~= nil
+ if (stderr ~= 'curl: (52) Empty reply from server'
+ and stderr ~= 'curl: (28) Failed to connect to api.openweathermap.org port 443: Connection timed out'
+ and stderr:find('^curl: %(18%) transfer closed with %d+ bytes remaining to read$') ~= nil
) then
show_warning(stderr)
end