local os = require('os') naughty = require('naughty') local wibox = require('wibox') local awful = require('awful') local gears = require('gears') local json = require('json') local home = os.getenv('HOME') local todo_path = home .. '/.config/todo/todo.json' function read_all(file) return content end function todo_list_widget(todo, s) local text = '\n ' .. todo.title .. '\n' for key, item in pairs(todo.items) do text = text .. ' - ' .. item .. '\n' end local text = wibox.widget { markup = text, align = 'left', valign = 'top', font = "Ubuntu 18", widget = wibox.widget.textbox } local widget = wibox.widget.background(text, todo.color, function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 20) end) widget.shape_border_width = 1 widget.shape_border_color = "#ffffff" widget.forced_width = todo.width widget.forced_height = todo.height widget.point = { x = todo.x, y = todo.y } return widget end function add_background_widget(s) local f = io.open(todo_path, "rb") if f ~= nil then local content = f:read("*all") f:close() todo = json.parse(content) local l = wibox.layout { layout = wibox.layout.manual } 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 { l, layout = wibox.layout.manual } background_widget:struts({left=0, right=0, top=0, bottom=0}) end end