naughty: icon_size added to config and notify()
Signed-off-by: koniu <gkusnierz@gmail.com>
This commit is contained in:
parent
46dfccd95f
commit
91dfbbb4eb
|
@ -48,6 +48,7 @@ module("naughty")
|
||||||
-- @field ontop Boolean forcing popups to display on top. Default: true
|
-- @field ontop Boolean forcing popups to display on top. Default: true
|
||||||
-- @field font Popup font. Default: beautiful.font or "Verdana 8"
|
-- @field font Popup font. Default: beautiful.font or "Verdana 8"
|
||||||
-- @field icon Popup icon. Default: nil
|
-- @field icon Popup icon. Default: nil
|
||||||
|
-- @field icon_size Size of the icon in pixels. Default: 16
|
||||||
-- @field fg Foreground color. Default: beautiful.fg_focus or '#ffffff'
|
-- @field fg Foreground color. Default: beautiful.fg_focus or '#ffffff'
|
||||||
-- @field bg Background color. Default: beautiful.bg_focus or '#535d6c'
|
-- @field bg Background color. Default: beautiful.bg_focus or '#535d6c'
|
||||||
-- @field border_color Border color.
|
-- @field border_color Border color.
|
||||||
|
@ -66,6 +67,7 @@ config.gap = 1
|
||||||
config.ontop = true
|
config.ontop = true
|
||||||
config.font = beautiful.font or "Verdana 8"
|
config.font = beautiful.font or "Verdana 8"
|
||||||
config.icon = nil
|
config.icon = nil
|
||||||
|
config.icon_size = 16
|
||||||
config.fg = beautiful.fg_focus or '#ffffff'
|
config.fg = beautiful.fg_focus or '#ffffff'
|
||||||
config.bg = beautiful.bg_focus or '#535d6c'
|
config.bg = beautiful.bg_focus or '#535d6c'
|
||||||
config.border_color = beautiful.border_focus or '#535d6c'
|
config.border_color = beautiful.border_focus or '#535d6c'
|
||||||
|
@ -153,6 +155,7 @@ end
|
||||||
-- @param title Title of the notification
|
-- @param title Title of the notification
|
||||||
-- @param position Corner of the workarea the popups will appear
|
-- @param position Corner of the workarea the popups will appear
|
||||||
-- @param icon Path to icon
|
-- @param icon Path to icon
|
||||||
|
-- @param icon_size Desired icon size in px
|
||||||
-- @param fg Foreground color
|
-- @param fg Foreground color
|
||||||
-- @param bg Background color
|
-- @param bg Background color
|
||||||
-- @param screen Target screen for the notification
|
-- @param screen Target screen for the notification
|
||||||
|
@ -163,6 +166,7 @@ function notify(args)
|
||||||
local timeout = args.timeout or config.timeout
|
local timeout = args.timeout or config.timeout
|
||||||
local position = args.position or config.position
|
local position = args.position or config.position
|
||||||
local icon = args.icon or config.icon
|
local icon = args.icon or config.icon
|
||||||
|
local icon_size = args.icon_size or config.icon_size
|
||||||
local text = args.text or ""
|
local text = args.text or ""
|
||||||
local screen = args.screen or config.screen
|
local screen = args.screen or config.screen
|
||||||
local ontop = args.ontop or config.ontop
|
local ontop = args.ontop or config.ontop
|
||||||
|
@ -213,8 +217,9 @@ function notify(args)
|
||||||
if icon then
|
if icon then
|
||||||
iconbox = widget({ type = "imagebox", name = "icon", align = "left" })
|
iconbox = widget({ type = "imagebox", name = "icon", align = "left" })
|
||||||
iconbox:buttons({ button({ }, 1, function () destroy(notification) end) })
|
iconbox:buttons({ button({ }, 1, function () destroy(notification) end) })
|
||||||
iconbox.image = image(icon)
|
local img = image(icon)
|
||||||
iconbox.width = 20
|
if icon_size then img:crop_and_scale(0,0,img.height,img.width,icon_size,icon_size) end
|
||||||
|
iconbox.image = img
|
||||||
end
|
end
|
||||||
|
|
||||||
box.widgets = { iconbox, textbox }
|
box.widgets = { iconbox, textbox }
|
||||||
|
|
Loading…
Reference in New Issue