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.
3 Licensed under GNU General Public License v2
8 local helpers = require("lain.helpers")
9 local markup = require("lain.util").markup
10 local awful = require("awful")
11 local naughty = require("naughty")
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)
26 task.notification_preset.screen = task.followtag and awful.screen.focused() or scr or 1
28 helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f)
29 local widget_focused = true
31 if mouse.current_widgets then
32 widget_focused = false
33 for _,v in ipairs(mouse.current_widgets) do
34 if task.widget == v then
41 if widget_focused then
43 task.notification = naughty.notify {
44 preset = task.notification_preset,
46 text = markup.font(task.notification_preset.font,
47 awful.util.escape(f:gsub("\n*$", "")))
53 function task.prompt()
55 prompt = task.prompt_text,
56 textbox = awful.screen.focused().mypromptbox.widget,
57 exe_callback = function(t)
58 helpers.async(t, function(f)
60 preset = task.notification_preset,
62 text = markup.font(task.notification_preset.font,
63 awful.util.escape(f:gsub("\n*$", "")))
67 history_path = awful.util.getdir("cache") .. "/history_task"
71 function task.attach(widget, args)
72 local args = args or {}
73 task.show_cmd = args.show_cmd or "task next"
74 task.prompt_text = args.prompt_text or "Enter task command: "
75 task.followtag = args.followtag or false
76 task.notification_preset = args.notification_preset
79 if not task.notification_preset then
80 task.notification_preset = {
81 font = "Monospace 10",
82 icon = helpers.icons_dir .. "/taskwarrior.png"
87 widget:connect_signal("mouse::enter", function () task.show() end)
88 widget:connect_signal("mouse::leave", function () task.hide() end)