fix few issues

This commit is contained in:
streetturtle 2020-12-02 09:18:16 -05:00
parent bc7008458e
commit 8be78d4fdd
5 changed files with 17 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 .. '<span color="' .. ((i % 2 == 0) and accent_color or main_color) .. '">' .. v .. '</span>' .. (with_spaces and ' ' or '')
res = res .. '<span color="'
.. ((i % 2 == 0) and accent_color or main_color)
.. '">' .. v .. '</span>'
.. (with_spaces and ' ' or '')
end
self:get_children_by_id('clock')[1]:set_markup(res)
end