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 string = { len = string.len }
17 local tonumber = tonumber
19 local setmetatable = setmetatable
21 -- Taskwarrior notification
22 -- lain.widgets.contrib.task
25 local task_notification = nil
28 if task_notification ~= nil then
29 naughty.destroy(task_notification)
30 task_notification = nil
40 c_text = "<span font='"
42 .. task.font_size .. "'>"
43 .. f:read("*all"):gsub("\n*$", "")
47 task_notification = naughty.notify({ title = "[task next]",
49 icon = task.notify_icon,
50 position = task.position,
53 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<span font='"
64 .. task.font_size .. "'>"
71 icon = task.notify_icon,
72 position = task.position,
75 timeout = task.timeout,
79 awful.util.getdir("cache") .. "/history_task_add")
82 function task:prompt_search()
83 awful.prompt.run({ prompt = "Search task: " },
84 mypromptbox[mouse.screen].widget,
86 local f = io.popen("task " .. ...)
87 c_text = f:read("*all"):gsub(" \n*$", "")
90 if string.len(c_text) == 0
92 c_text = "No results found."
94 c_text = "<span font='"
96 .. task.font_size .. "'>"
102 title = "[task next " .. ... .. "]",
104 icon = task.notify_icon,
105 position = task.position,
108 timeout = task.timeout,
112 awful.util.getdir("cache") .. "/history_task")
115 function task:attach(widget, args)
116 local args = args or {}
118 task.font_size = tonumber(args.font_size) or 12
119 task.font = beautiful.font:sub(beautiful.font:find(""),
120 beautiful.font:find(" "))
121 task.fg = args.fg or beautiful.fg_normal or "#FFFFFF"
122 task.bg = args.bg or beautiful.bg_normal or "#FFFFFF"
123 task.position = args.position or "top_right"
124 task.timeout = args.timeout or 7
126 task.notify_icon = icons_dir .. "/taskwarrior/task.png"
127 task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
129 widget:connect_signal("mouse::enter", function () task:show() end)
130 widget:connect_signal("mouse::leave", function () task:hide() end)
133 return setmetatable(task, { __call = function(_, ...) return create(...) end })