awesome: Add basic calendar highlighting support
This commit is contained in:
parent
a81388d206
commit
e4c0786e79
|
@ -1,4 +1,5 @@
|
|||
local helpers = require("lain.helpers")
|
||||
local markup = require("lain.util.markup")
|
||||
|
||||
local utils = {}
|
||||
|
||||
|
@ -10,5 +11,11 @@ function utils.handle_pid(command, callback)
|
|||
helpers.async_with_shell(string.format("ps x -o pid=,command=|grep -E '^\\s*[0-9]* %s$'|sed 's/\\s*\\([0-9]*\\) .*/\\1/'", command), callback)
|
||||
end
|
||||
|
||||
function utils.ansi2markup(ansi, colors)
|
||||
return ansi
|
||||
:gsub("\x1b%[1m([^\x1b]*)", markup.bold("%1"))
|
||||
:gsub("\x1b%[7m([^\x1b]*)", markup.color(colors.base1, colors.base02, "%1"))
|
||||
:gsub("\x1b%[0m([^\x1b]*)", "%1")
|
||||
end
|
||||
|
||||
return utils
|
||||
|
|
|
@ -211,10 +211,10 @@ widgets.cal.toggle = function()
|
|||
naughty.destroy(widgets.cal.notification)
|
||||
widgets.cal.notification = nil
|
||||
else
|
||||
helpers.async({ "khal", "calendar" }, function(output)
|
||||
helpers.async({ "khal", "--color", "calendar" }, function(output)
|
||||
widgets.cal.notification = naughty.notify{
|
||||
screen = awful.screen.focused(),
|
||||
text = output:gsub("\n$", ""),
|
||||
text = utils.ansi2markup(output:gsub("\n$", ""), theme.colors),
|
||||
timeout = 0,
|
||||
}
|
||||
end)
|
||||
|
|
Reference in a new issue