awesome: Add taskwarrior widget
This commit is contained in:
parent
d189801d3d
commit
e4ffc80fc3
BIN
home/.config/awesome/icons/tasks.png
Normal file
BIN
home/.config/awesome/icons/tasks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 B |
|
@ -229,6 +229,8 @@ awful.screen.connect_for_each_screen(function(s)
|
||||||
widgets.temp.widget,
|
widgets.temp.widget,
|
||||||
widgets.bat_icon,
|
widgets.bat_icon,
|
||||||
widgets.bat.widget,
|
widgets.bat.widget,
|
||||||
|
widgets.taskwarrior.icon,
|
||||||
|
widgets.taskwarrior.widget,
|
||||||
mytextclock,
|
mytextclock,
|
||||||
s.mylayoutbox,
|
s.mylayoutbox,
|
||||||
},
|
},
|
||||||
|
|
|
@ -227,4 +227,42 @@ widgets.cal.attach = function(parent)
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
widgets.taskwarrior = {}
|
||||||
|
|
||||||
|
-- WTF lua?
|
||||||
|
widgets.taskwarrior.due = 0
|
||||||
|
widgets.taskwarrior.due_today = 0
|
||||||
|
widgets.taskwarrior.due_tomorrow = 0
|
||||||
|
widgets.taskwarrior.overdue = 0
|
||||||
|
|
||||||
|
widgets.taskwarrior.icon = wibox.widget.imagebox(iconsdir .. "tasks.png")
|
||||||
|
widgets.taskwarrior.widget = wibox.widget.textbox()
|
||||||
|
widgets.taskwarrior.update = function()
|
||||||
|
helpers.async({ "task", "+DUE", "count" }, function(output)
|
||||||
|
widgets.taskwarrior.due = tonumber(output)
|
||||||
|
widgets.taskwarrior.redraw()
|
||||||
|
end)
|
||||||
|
helpers.async({ "task", "due:today", "count" }, function(output)
|
||||||
|
widgets.taskwarrior.due_today = tonumber(output)
|
||||||
|
widgets.taskwarrior.redraw()
|
||||||
|
end)
|
||||||
|
helpers.async({ "task", "due:tomorrow", "count" }, function(output)
|
||||||
|
widgets.taskwarrior.due_tomorrow = tonumber(output)
|
||||||
|
widgets.taskwarrior.redraw()
|
||||||
|
end)
|
||||||
|
helpers.async({ "task", "+OVERDUE", "count" }, function(output)
|
||||||
|
widgets.taskwarrior.overdue = tonumber(output)
|
||||||
|
widgets.taskwarrior.redraw()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
widgets.taskwarrior.redraw = function()
|
||||||
|
widgets.taskwarrior.widget:set_markup(
|
||||||
|
markup.fontfg(theme.font, theme.fg_normal, widgets.taskwarrior.due .. ":")
|
||||||
|
.. " " .. markup.fontfg(theme.font, theme.colors.red, widgets.taskwarrior.overdue)
|
||||||
|
.. " " .. markup.fontfg(theme.font, theme.colors.orange, widgets.taskwarrior.due_today)
|
||||||
|
.. " " .. markup.fontfg(theme.font, theme.colors.yellow, widgets.taskwarrior.due_tomorrow - widgets.taskwarrior.due_today)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
helpers.newtimer("taskwarrior", 60, widgets.taskwarrior.update)
|
||||||
|
|
||||||
return widgets
|
return widgets
|
||||||
|
|
Reference in a new issue