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")
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)
27 if task.followtag then
28 task.notification_preset.screen = awful.screen.focused()
30 task.notification_preset.screen = scr
33 helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f)
34 local widget_focused = true
36 if mouse.current_widgets then
37 widget_focused = false
38 for _,v in ipairs(mouse.current_widgets) do
39 if task.widget == v then
46 if widget_focused then
48 task.notification = naughty.notify({
49 preset = task.notification_preset,
51 text = markup.font(task.notification_preset.font,
52 awful.util.escape(f:gsub("\n*$", "")))
58 function task.prompt()
60 prompt = task.prompt_text,
61 textbox = awful.screen.focused().mypromptbox.widget,
62 exe_callback = function(t)
63 helpers.async(t, function(f)
65 preset = task.notification_preset,
67 text = markup.font(task.notification_preset.font,
68 awful.util.escape(f:gsub("\n*$", "")))
72 history_path = awful.util.getdir("cache") .. "/history_task"
76 function task.attach(widget, args)
77 local args = args or {}
78 task.show_cmd = args.show_cmd or "task next"
79 task.prompt_text = args.prompt_text or "Enter task command: "
80 task.followtag = args.followtag or false
81 task.notification_preset = args.notification_preset
84 if not task.notification_preset then
85 task.notification_preset = {
86 font = "Monospace 10",
87 icon = helpers.icons_dir .. "/taskwarrior.png"
92 widget:connect_signal("mouse::enter", function () task.show() end)
93 widget:connect_signal("mouse::leave", function () task.hide() end)