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 markup = require("lain.util").markup
11 local awful = require("awful")
12 local naughty = require("naughty")
13 local string = { format = string.format, gsub = string.gsub }
15 -- Taskwarrior notification
16 -- lain.widget.contrib.task
20 if not task.notification then return end
21 naughty.destroy(task.notification)
22 task.notification = nil
25 function task.show(scr)
28 if task.followtag then
29 task.notification_preset.screen = awful.screen.focused()
31 task.notification_preset.screen = scr
34 helpers.async(task.show_cmd, function(f)
35 task.notification = naughty.notify({
36 preset = task.notification_preset,
37 title = task.show_cmd,
38 text = markup.font(task.notification_preset.font,
39 awful.util.escape(f:gsub("\n*$", "")))
44 function task.prompt()
46 prompt = task.prompt_text,
47 textbox = awful.screen.focused().mypromptbox.widget,
48 exe_callback = function(t)
49 helpers.async(t, function(f)
51 preset = task.notification_preset,
53 text = markup.font(task.notification_preset.font,
54 awful.util.escape(f:gsub("\n*$", "")))
58 history_path = awful.util.getdir("cache") .. "/history_task"
62 function task.attach(widget, args)
63 local args = args or {}
64 task.show_cmd = args.show_cmd or "task next"
65 task.prompt_text = args.prompt_text or "Enter task command: "
66 task.followtag = args.followtag or false
67 task.notification_preset = args.notification_preset
69 if not task.notification_preset then
70 task.notification_preset = {
71 font = "Monospace 10",
72 icon = helpers.icons_dir .. "/taskwarrior.png"
77 widget:connect_signal("mouse::enter", function () task.show() end)
78 widget:connect_signal("mouse::leave", function () task.hide() end)