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 helpers = require("lain.helpers")
10 local awful = require("awful")
11 local naughty = require("naughty")
12 local string = { format = string.format, gsub = string.gsub }
14 -- Taskwarrior notification
15 -- lain.widgets.contrib.task
19 if not task.notification then return end
20 naughty.destroy(task.notification)
21 task.notification = nil
24 function task.show(scr)
27 if task.followtag then
28 task.notification_preset.screen = awful.screen.focused()
30 task.notification_preset.screen = scr
33 helpers.async(task.show_cmd, function(f)
34 task.notification = naughty.notify({
35 preset = task_notification_preset,
36 title = task.show_cmd,
37 text = markup.font(task.notification_preset.font,
38 awful.util.escape(f:gsub("\n*$", "")))
43 function task.prompt()
45 prompt = task.prompt_text,
46 textbox = awful.screen.focused().mypromptbox.widget,
47 exe_callback = function(t)
48 helpers.async(t, function(f)
50 preset = task.notification_preset,
52 text = markup.font(task.notification_preset.font,
53 awful.util.escape(f:gsub("\n*$", "")))
57 history_path = awful.util.getdir("cache") .. "/history_task"
61 function task.attach(widget, args)
62 local args = args or {}
63 task.show_cmd = args.show_cmd or "task next"
64 task.prompt_text = args.prompt_text or "Enter task command: "
65 task.followtag = args.followtag or false
66 task.notification_preset = args.notification_preset
68 if not task.notification_preset then
69 task.notification_preset = {
70 font = "Monospace 10",
71 icon = helpers.icons_dir .. "/taskwarrior.png"
76 widget:connect_signal("mouse::enter", function () task.show() end)
77 widget:connect_signal("mouse::leave", function () task.hide() end)