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:
Uli Schlachter 2016-04-28 17:47:12 +02:00
parent a55baf9e3c
commit 1714a6513b
2 changed files with 7 additions and 6 deletions

View File

@ -47,9 +47,10 @@ function theme_assets.taglist_squares_unsel(size, fg)
end end
function theme_assets.wallpaper(bg, fg, alt_fg) function theme_assets.wallpaper(bg, fg, alt_fg, s)
local height = screen[1].workarea.height s = s or screen.primary
local width = screen[1].workarea.width local height = s.workarea.height
local width = s.workarea.width
local img = cairo.ImageSurface(cairo.Format.ARGB32, width, height) local img = cairo.ImageSurface(cairo.Format.ARGB32, width, height)
local cr = cairo.Context(img) local cr = cairo.Context(img)

View File

@ -91,9 +91,9 @@ local wallpaper_alt_fg = xrdb.color12
if not is_dark_bg then if not is_dark_bg then
wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg
end end
theme.wallpaper = theme_assets.wallpaper( theme.wallpaper = function(s)
wallpaper_bg, wallpaper_fg, wallpaper_alt_fg return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s)
) end
return theme return theme