xresources theme: Let beautiful.wallpaper be a function
This makes the code create a wallpaper of the correct size, instead of cairo later having to scale the wallpaper up to fill the screen (if it has a different size than screen 1). Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
a55baf9e3c
commit
1714a6513b
|
@ -47,9 +47,10 @@ function theme_assets.taglist_squares_unsel(size, fg)
|
|||
end
|
||||
|
||||
|
||||
function theme_assets.wallpaper(bg, fg, alt_fg)
|
||||
local height = screen[1].workarea.height
|
||||
local width = screen[1].workarea.width
|
||||
function theme_assets.wallpaper(bg, fg, alt_fg, s)
|
||||
s = s or screen.primary
|
||||
local height = s.workarea.height
|
||||
local width = s.workarea.width
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, width, height)
|
||||
local cr = cairo.Context(img)
|
||||
|
||||
|
|
|
@ -91,9 +91,9 @@ local wallpaper_alt_fg = xrdb.color12
|
|||
if not is_dark_bg then
|
||||
wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg
|
||||
end
|
||||
theme.wallpaper = theme_assets.wallpaper(
|
||||
wallpaper_bg, wallpaper_fg, wallpaper_alt_fg
|
||||
)
|
||||
theme.wallpaper = function(s)
|
||||
return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s)
|
||||
end
|
||||
|
||||
return theme
|
||||
|
||||
|
|
Loading…
Reference in New Issue