From 8be78d4fddfc2c88352b25f5d8d89c6dc14df37c Mon Sep 17 00:00:00 2001 From: streetturtle Date: Wed, 2 Dec 2020 09:18:16 -0500 Subject: fix few issues --- todo-widget/todo.lua | 4 ++-- translate-widget/translate.lua | 4 ++-- volume-widget/volume.lua | 2 +- weather-widget/weather.lua | 16 ++++++---------- word-clock-widget/word-clock.lua | 9 ++++++--- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/todo-widget/todo.lua b/todo-widget/todo.lua index 71484b2..71bf832 100644 --- a/todo-widget/todo.lua +++ b/todo-widget/todo.lua @@ -200,7 +200,7 @@ local function worker(args) widget = wibox.container.background } - trash_button:connect_signal("button::press", function(c) + trash_button:connect_signal("button::press", function() table.remove(result.todo_items, i) spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function () spawn.easy_async(GET_TODO_ITEMS, function(stdout) update_widget(stdout) end) @@ -214,7 +214,7 @@ local function worker(args) widget = wibox.widget.imagebox } - move_up:connect_signal("button::press", function(c) + move_up:connect_signal("button::press", function() local temp = result.todo_items[i] result.todo_items[i] = result.todo_items[i-1] result.todo_items[i-1] = temp diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua index 9352ac9..811e136 100644 --- a/translate-widget/translate.lua +++ b/translate-widget/translate.lua @@ -159,9 +159,9 @@ input_widget:setup{ widget = wibox.container.margin } -local function launch(args) +local function launch(user_args) - local args = args or {} + local args = user_args or {} local api_key = args.api_key local url = args.url diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index 0e13f38..86d2e4c 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -165,7 +165,7 @@ local function worker(args) --}}} --{{{ Set initial icon - spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) + spawn.easy_async(GET_VOLUME_CMD, function(stdout) parse_output(stdout) volume.widget.image = PATH_TO_ICONS .. volume_icon_name .. ".svg" end) 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 '' .. uvi .. '' 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 diff --git a/word-clock-widget/word-clock.lua b/word-clock-widget/word-clock.lua index fc4a5b5..12d5d83 100644 --- a/word-clock-widget/word-clock.lua +++ b/word-clock-widget/word-clock.lua @@ -55,9 +55,9 @@ end local text_clock = {} -local function worker(args) +local function worker(user_args) - local args = args or {} + local args = user_args or {} local main_color = args.main_color or beautiful.fg_normal local accent_color = args.accent_color or beautiful.fg_urgent @@ -81,7 +81,10 @@ local function worker(args) local t = split(time) local res = '' for i, v in ipairs(t) do - res = res .. '' .. v .. '' .. (with_spaces and ' ' or '') + res = res .. '' .. v .. '' + .. (with_spaces and ' ' or '') end self:get_children_by_id('clock')[1]:set_markup(res) end -- cgit v1.2.3