function copy_naughty()
-- Copy naughty notification(s) to clipboard in v4.3; API changes in
-- later versions should simplify. Multiple notifications are outputed
-- to a table, then concatenated as one string sent to xclip.
local cs -- "combined string"
local output = {}
for s in pairs(naughty.notifications) do
for p in pairs(naughty.notifications[s]) do
local ntfs = naughty.notifications[s][p]
for i, notify in pairs(ntfs) do
table.insert(output, notify.textbox.text)
end
end
end
if output[1] == nil then return nil end
local lb = "\n" ; for i = 1, #output do
if cs == nil then cs = output[i] else
cs = cs .. lb .. output[i]
end
end
io.popen('xclip -selection clipboard','w'):write(cs):close()
naughty.notify({ position = "bottom_middle", timeout = 1, text = "Copied" })
end