fix(lib: naughty: core): make it work with textbox per-screen dpi
Closes https://github.com/awesomeWM/awesome/pull/464.
This commit is contained in:
parent
28ffdb050e
commit
f2e554de91
|
@ -454,6 +454,8 @@ function naughty.notify(args)
|
|||
local border_color = args.border_color or preset.border_color or beautiful.bg_focus or '#535d6c'
|
||||
local notification = { screen = screen, destroy_cb = destroy_cb, timeout = timeout }
|
||||
|
||||
local textbox_context = {dpi=bt.xresources.get_dpi(s)}
|
||||
|
||||
-- replace notification if needed
|
||||
if args.replaces_id then
|
||||
local obj = naughty.getById(args.replaces_id)
|
||||
|
@ -526,7 +528,7 @@ function naughty.notify(args)
|
|||
actiontextbox:set_font(font)
|
||||
actiontextbox:set_markup(string.format('<b>%s</b>', action))
|
||||
-- calculate the height and width
|
||||
local w, h = actiontextbox:fit(nil, -1, -1) -- Hack! :(
|
||||
local w, h = actiontextbox:fit(textbox_context, -1, -1) -- Hack! :(
|
||||
local height = h + 2 * margin
|
||||
local width = w + 2 * margin
|
||||
|
||||
|
@ -596,7 +598,7 @@ function naughty.notify(args)
|
|||
|
||||
-- calculate the height
|
||||
if not height then
|
||||
local w, h = textbox:fit(nil, -1, -1) -- Hack! :-(
|
||||
local w, h = textbox:fit(textbox_context, -1, -1) -- Hack! :-(
|
||||
if iconbox and icon_h + 2 * margin > h + 2 * margin then
|
||||
height = icon_h + 2 * margin
|
||||
else
|
||||
|
@ -608,7 +610,7 @@ function naughty.notify(args)
|
|||
|
||||
-- calculate the width
|
||||
if not width then
|
||||
local w, h = textbox:fit(nil, -1, -1) -- Hack! :-(
|
||||
local w, h = textbox:fit(textbox_context, -1, -1) -- Hack! :-(
|
||||
width = w + (iconbox and icon_w + 2 * margin or 0) + 2 * margin
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue