mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-11 17:18:02 +08:00
Add notification icon handler
This commit is contained in:
parent
14c2840c3a
commit
f28d4cd7bd
1 changed files with 20 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue