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)
26 if task.followtag then
27 task.notification_preset.screen = awful.screen.focused()
29 task.notification_preset.screen = scr
32 helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f)
33 local widget_focused = true
35 if mouse.current_widgets then
36 widget_focused = false
37 for _,v in ipairs(mouse.current_widgets) do
38 if task.widget == v then
45 if widget_focused then
47 task.notification = naughty.notify({
48 preset = task.notification_preset,
50 text = markup.font(task.notification_preset.font,
51 awful.util.escape(f:gsub("\n*$", "")))
57 function task.prompt()
59 prompt = task.prompt_text,
60 textbox = awful.screen.focused().mypromptbox.widget,
61 exe_callback = function(t)
62 helpers.async(t, function(f)
64 preset = task.notification_preset,
66 text = markup.font(task.notification_preset.font,
67 awful.util.escape(f:gsub("\n*$", "")))
71 history_path = awful.util.getdir("cache") .. "/history_task"
75 function task.attach(widget, args)
76 local args = args or {}
77 task.show_cmd = args.show_cmd or "task next"
78 task.prompt_text = args.prompt_text or "Enter task command: "
79 task.followtag = args.followtag or false
80 task.notification_preset = args.notification_preset
83 if not task.notification_preset then
84 task.notification_preset = {
85 font = "Monospace 10",
86 icon = helpers.icons_dir .. "/taskwarrior.png"
91 widget:connect_signal("mouse::enter", function () task.show() end)
92 widget:connect_signal("mouse::leave", function () task.hide() end)