diff --git a/awesome/background_widget.lua b/awesome/background_widget.lua index 62bede1..dfd5b10 100644 --- a/awesome/background_widget.lua +++ b/awesome/background_widget.lua @@ -37,46 +37,50 @@ end function add_background_widget(s) - local f = io.open(todo_path, "rb") + awful.spawn.easy_async_with_shell(":", function() - if f ~= nil then + local f = io.open(todo_path, "rb") - local content = f:read("*all") - f:close() + if f ~= nil then - todo = json.parse(content) + local content = f:read("*all") + f:close() - local margin = 25 + todo = json.parse(content) - local l = wibox.layout { - homogeneous = true, - spacing = margin, - forced_num_cols = 3, - layout = wibox.layout.grid, - } + local margin = 25 - l:set_orientation('horizontal') + local l = wibox.layout { + homogeneous = true, + spacing = margin, + forced_num_cols = 3, + layout = wibox.layout.grid, + } - local widgets = {} + l:set_orientation('horizontal') + + local widgets = {} + + for key, val in pairs(todo) do + l:add(todo_list_widget(val, s)) + end + + background_widget = awful.wibar({ + screen = s, + height = s.geometry.height, + bg = "#00000000", + }) + + background_widget:setup { + wibox.container.margin(l, margin, margin, margin, margin), + layout = wibox.layout.manual + } + + background_widget:struts({left=0, right=0, top=0, bottom=0}) - for key, val in pairs(todo) do - l:add(todo_list_widget(val, s)) end - background_widget = awful.wibar({ - screen = s, - height = s.geometry.height, - bg = "#00000000", - }) - - background_widget:setup { - wibox.container.margin(l, margin, margin, margin, margin), - layout = wibox.layout.manual - } - - background_widget:struts({left=0, right=0, top=0, bottom=0}) - - end + end) end