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")
18 >>>>>>> upstream/master
20 local string = { len = string.len }
21 local tonumber = tonumber
23 local setmetatable = setmetatable
25 -- Taskwarrior notification
26 -- lain.widgets.contrib.task
29 local task_notification = nil
32 if task_notification ~= nil then
33 naughty.destroy(task_notification)
34 task_notification = nil
41 function task:show(scr_pos)
42 >>>>>>> upstream/master
49 if task.followmouse then
50 local scrp = mouse.screen
52 local scrp = scr_pos or task.scr_pos
55 >>>>>>> upstream/master
57 c_text = "<span font='"
59 .. task.font_size .. "'>"
60 .. f:read("*all"):gsub("\n*$", "")
64 task_notification = naughty.notify({ title = "[task next]",
66 icon = task.notify_icon,
67 position = task.position,
70 timeout = task.timeout,
74 >>>>>>> upstream/master
78 function task:prompt_add()
79 awful.prompt.run({ prompt = "Add task: " },
80 mypromptbox[mouse.screen].widget,
82 local f = io.popen("task add " .. ...)
83 c_text = "\n<span font='"
85 .. task.font_size .. "'>"
92 icon = task.notify_icon,
93 position = task.position,
96 timeout = task.timeout,
100 awful.util.getdir("cache") .. "/history_task_add")
103 function task:prompt_search()
104 awful.prompt.run({ prompt = "Search task: " },
105 mypromptbox[mouse.screen].widget,
107 local f = io.popen("task " .. ...)
108 c_text = f:read("*all"):gsub(" \n*$", "")
111 if string.len(c_text) == 0
113 c_text = "No results found."
115 c_text = "<span font='"
117 .. task.font_size .. "'>"
123 title = "[task next " .. ... .. "]",
125 icon = task.notify_icon,
126 position = task.position,
129 timeout = task.timeout,
132 screen = mouse.screen
133 >>>>>>> upstream/master
137 awful.util.getdir("cache") .. "/history_task")
140 function task:attach(widget, args)
142 local args = args or {}
144 task.font_size = tonumber(args.font_size) or 12
145 task.font = beautiful.font:sub(beautiful.font:find(""),
146 beautiful.font:find(" "))
147 task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
148 task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
149 task.position = args.position or "top_right"
150 task.timeout = args.timeout or 7
152 local args = args or {}
154 task.font_size = tonumber(args.font_size) or 12
155 task.font = beautiful.font:sub(beautiful.font:find(""),
156 beautiful.font:find(" "))
157 task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
158 task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
159 task.position = args.position or "top_right"
160 task.timeout = args.timeout or 7
161 task.scr_pos = args.scr_pos or 1
162 task.followmouse = args.followmouse or false
163 >>>>>>> upstream/master
165 task.notify_icon = icons_dir .. "/taskwarrior/task.png"
166 task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
169 widget:connect_signal("mouse::enter", function () task:show() end)
171 widget:connect_signal("mouse::enter", function () task:show(task.scr_pos) end)
172 >>>>>>> upstream/master
173 widget:connect_signal("mouse::leave", function () task:hide() end)
176 return setmetatable(task, { __call = function(_, ...) return create(...) end })