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(string.format("%s -c '%s'", awful.util.shell, task.cmd),
35 task.notification = naughty.notify({
36 preset = task_notification_preset,
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(string.format("%s -c '%s'", awful.util.shell, t),
52 preset = task_notification_preset,
54 text = markup.font(task.notification_preset.font,
55 awful.util.escape(f:gsub("\n*$", "")))
59 history_path = awful.util.getdir("cache") .. "/history_task"
63 function task.attach(widget, args)
64 local args = args or {}
65 task.show_cmd = args.cmd or "task"
66 task.prompt_text = args.prompt_text or "Enter task command: "
67 task.followtag = args.followtag or false
68 task.notification_preset = args.notification_preset
70 if not task.notification_preset then
71 task.notification_preset = naughty.config.defaults
72 task.notification_preset.font = "Monospace 10"
73 task.notification_preset.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)