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
5 * (c) 2013, Luke Bonham
10 local icons_dir = require("lain.helpers").icons_dir
12 local awful = require("awful")
13 local beautiful = require("beautiful")
14 local naughty = require("naughty")
17 local string = { len = string.len }
18 local tonumber = tonumber
20 local setmetatable = setmetatable
22 -- Taskwarrior notification
26 local task_notification = nil
29 if task_notification ~= nil then
30 naughty.destroy(task_notification)
31 task_notification = nil
41 c_text = "<tt><span font='"
43 .. task.font_size .. "'>"
44 .. f:read("*all"):gsub("\n*$", "")
48 task_notification = naughty.notify({ title = "[task next]",
50 icon = task.notify_icon,
51 position = task.position,
54 timeout = task.timeout })
57 function task:prompt_add()
58 awful.prompt.run({ prompt = "Add task: " },
59 mypromptbox[mouse.screen].widget,
61 local f = io.popen("task add " .. ...)
62 c_text = "\n<tt><span font='"
64 .. task.font_size .. "'>"
70 icon = task.notify_icon,
71 position = task.position,
74 timeout = task.timeout
78 awful.util.getdir("cache") .. "/history_task_add")
81 function task:prompt_search()
82 awful.prompt.run({ prompt = "Search task: " },
83 mypromptbox[mouse.screen].widget,
85 local f = io.popen("task " .. ...)
86 c_text = f:read("*all")
89 if string.len(c_text) == 0
91 c_text = "No results found."
93 c_text = "<tt><span font='"
95 .. task.font_size .. "'>"
102 icon = task.notify_icon,
103 position = task.position,
106 timeout = task.timeout
110 awful.util.getdir("cache") .. "/history_task")
113 function task:attach(widget, args)
114 local args = args or {}
116 task.font_size = tonumber(args.font_size) or 12
117 task.font = beautiful.font:sub(beautiful.font:find(""),
118 beautiful.font:find(" "))
119 task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
120 task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
121 task.position = args.position or "top_right"
122 task.timeout = args.timeout or 7
124 task.notify_icon = icons_dir .. "/taskwarrior/task.png"
125 task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
127 widget:connect_signal("mouse::enter", function () task:show() end)
128 widget:connect_signal("mouse::leave", function () task:hide() end)
131 return setmetatable(task, { __call = function(_, ...) return create(...) end })