naughty: Support file:// URIs for icon paths

From the Desktop Notification Specification:

'The "app_icon" parameter and "image-path" hint should be either an URI (file://
is the only URI schema supported right now) or [...]'
https://developer.gnome.org/notification-spec/#icons-and-images-formats

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-04-13 12:22:24 +02:00
parent d76d3e0b6a
commit e65ecb853b
1 changed files with 4 additions and 0 deletions

View File

@ -403,6 +403,10 @@ function naughty.notify(args)
local iconmargin = nil
local icon_w, icon_h = 0, 0
if icon then
-- Is this really an URI instead of a path?
if type(icon) == "string" and string.sub(icon, 1, 7) == "file://" then
icon = string.sub(icon, 8)
end
-- try to guess icon if the provided one is non-existent/readable
if type(icon) == "string" and not util.file_readable(icon) then
icon = util.geticonpath(icon, naughty.config.icon_formats, naughty.config.icon_dirs, icon_size) or icon