naughty: add support for widget layouts
Signed-off-by: Gregor Best <farhaven@googlemail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
1908bd3d57
commit
2b69d333f8
|
@ -20,6 +20,7 @@ local button = require("awful.button")
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local wibox = require("awful.wibox")
|
local wibox = require("awful.wibox")
|
||||||
local bt = require("beautiful")
|
local bt = require("beautiful")
|
||||||
|
local layout = require("awful.widget.layout")
|
||||||
|
|
||||||
--- Notification library
|
--- Notification library
|
||||||
module("naughty")
|
module("naughty")
|
||||||
|
@ -378,18 +379,32 @@ function notify(args)
|
||||||
notification.width = width + 2 * (border_width or 0)
|
notification.width = width + 2 * (border_width or 0)
|
||||||
|
|
||||||
-- position the wibox
|
-- position the wibox
|
||||||
local offset = get_offset(screen, notification.position, nil, notification.width, notification.height)
|
if iconbox and iconbox.image.height > textbox:extents()["height"] then
|
||||||
notification.box:geometry({ width = width,
|
notification.height = iconbox.image.height + (2 * config.border_width)
|
||||||
height = height,
|
else
|
||||||
|
notification.height = textbox:extents()["height"] + (2 * config.border_width)
|
||||||
|
end
|
||||||
|
notification.width = (iconbox and iconbox:extents()["width"] or 0) + textbox:extents()["width"] + (2 * config.border_width)
|
||||||
|
|
||||||
|
if capi.screen[screen].workarea.width < notification.width then
|
||||||
|
notification.width = capi.screen[screen].workarea.width - (2 * config.border_width) - (2 * config.padding)
|
||||||
|
end
|
||||||
|
if capi.screen[screen].workarea.height < notification.height then
|
||||||
|
notification.height = capi.screen[screen].workarea.height - (2 * config.border_width) - (2 * config.padding)
|
||||||
|
end
|
||||||
|
|
||||||
|
local offset = get_offset(screen, notification.position, notification.idx, notification.width, notification.height)
|
||||||
|
notification.box.ontop = ontop
|
||||||
|
notification.box:geometry({ width = notification.width,
|
||||||
|
height = notification.height,
|
||||||
x = offset.x,
|
x = offset.x,
|
||||||
y = offset.y })
|
y = offset.y })
|
||||||
notification.box.ontop = ontop
|
|
||||||
notification.box.opacity = opacity
|
notification.box.opacity = opacity
|
||||||
notification.box.screen = screen
|
notification.box.screen = screen
|
||||||
notification.idx = offset.idx
|
notification.idx = offset.idx
|
||||||
|
|
||||||
-- populate widgets
|
-- populate widgets
|
||||||
notification.box.widgets = { iconbox, textbox }
|
notification.box.widgets = { iconbox, textbox, ["layout"] = layout.horizontal.leftright }
|
||||||
|
|
||||||
-- insert the notification to the table
|
-- insert the notification to the table
|
||||||
table.insert(notifications[screen][notification.position], notification)
|
table.insert(notifications[screen][notification.position], notification)
|
||||||
|
|
Loading…
Reference in New Issue