Add notification icon handler

This commit is contained in:
elenapan 2020-03-19 07:50:59 +02:00
parent 14c2840c3a
commit f28d4cd7bd

View file

@ -1,6 +1,7 @@
local beautiful = require("beautiful")
local naughty = require("naughty")
local helpers = require("helpers")
local menubar = require("menubar")
notifications = {}
@ -79,6 +80,25 @@ function notifications.init(theme_name)
require("notifications.themes." .. theme_name)
end
-- Handle notification icon
naughty.connect_signal("request::icon", function(n, context, hints)
-- Handle other contexts here
if context ~= "app_icon" then return end
-- Use XDG icon
local path = menubar.utils.lookup_icon(hints.app_icon) or
menubar.utils.lookup_icon(hints.app_icon:lower())
if path then
n.icon = path
end
end)
-- Use XDG icon
naughty.connect_signal("request::action_icon", function(a, context, hints)
a.icon = menubar.utils.lookup_icon(hints.id)
end)
-- Initialize various notification daemons
require("notifications.volume")
require("notifications.brightness")