-function task.prompt_add()
- awful.prompt.run({ prompt = "Add task: " },
- mypromptbox[awful.screen.focused()].widget,
- function (...)
- local f = io.popen("task add " .. ...)
- c_text = "\n<span font='"
- .. task.font .. " "
- .. task.font_size .. "'>"
- .. awful.util.escape(f:read("*all"))
- .. "</span>"
- f:close()
-
- naughty.notify({
- text = c_text,
- icon = task.notify_icon,
- position = task.position,
- fg = task.fg,
- bg = task.bg,
- timeout = task.timeout,
- })
- end,
- nil,
- awful.util.getdir("cache") .. "/history_task_add")
-end
-
-function task.prompt_search()
- awful.prompt.run({ prompt = "Search task: " },
- mypromptbox[awful.screen.focused()].widget,
- function (...)
- local f = io.popen("task " .. ...)
- c_text = f:read("*all"):gsub(" \n*$", "")
- f:close()
-
- if string.len(c_text) == 0
- then
- c_text = "No results found."
- else
- c_text = "<span font='"
- .. task.font .. " "
- .. task.font_size .. "'>"
- .. awful.util.escape(c_text)
- .. "</span>"
- end
-
- naughty.notify({
- title = "[task next " .. ... .. "]",
- text = c_text,
- icon = task.notify_icon,
- position = task.position,
- fg = task.fg,
- bg = task.bg,
- timeout = task.timeout,
- screen = awful.screen.focused()
- })
- end,
- nil,
- awful.util.getdir("cache") .. "/history_task")
+function task.prompt()
+ awful.prompt.run {
+ prompt = task.prompt_text,
+ textbox = awful.screen.focused().mypromptbox.widget,
+ exe_callback = function(t)
+ helpers.async(t, function(f)
+ naughty.notify {
+ preset = task.notification_preset,
+ title = t,
+ text = markup.font(task.notification_preset.font,
+ awful.util.escape(f:gsub("\n*$", "")))
+ }
+ end)
+ end,
+ history_path = awful.util.getdir("cache") .. "/history_task"
+ }