All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 Licensed under GNU General Public License v2
9 local icons_dir = require("lain.helpers").icons_dir
11 local awful = require("awful")
12 local beautiful = require("beautiful")
13 local naughty = require("naughty")
16 local tonumber = tonumber
18 local setmetatable = setmetatable
23 local task_notification = nil
26 if task_notification ~= nil then
27 naughty.destroy(task_notification)
28 task_notification = nil
32 function task:show(t_out)
35 local tims = t_out or 0
37 -- let's take font only, font size is set in task table
38 local font = beautiful.font:sub(beautiful.font:find(""),
39 beautiful.font:find(" "))
43 c_text = "<tt><span font='" .. font .. " "
44 .. task.font_size+2 .. "'><b>Tasks next</b></span>\n"
45 .. "<span font='" .. font .. " "
46 .. task.font_size .. "'>"
47 .. f:read("*all") .. "\n"
51 task_notification = naughty.notify({ text = c_text,
52 icon = task.notify_icon,
53 position = task.position,
59 function task:attach(widget, args)
60 local args = args or {}
61 task.font_size = tonumber(args.font_size) or 12
62 task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
63 task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
64 task.position = args.position or "top_right"
66 task.notify_icon = icons_dir .. "taskwarrior.png"
68 widget:connect_signal("mouse::enter", function () task:show() end)
69 widget:connect_signal("mouse::leave", function () task:hide() end)
70 widget:buttons(awful.util.table.join( awful.button({ }, 1, function ()
71 task:show(0, -1) end),
72 awful.button({ }, 3, function ()
73 task:show(0, 1) end) ))
76 return setmetatable(task, { __call = function(_, ...) return create(...) end })