From 1714a6513b8a72743c0544279b7b5e196bf878c4 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 28 Apr 2016 17:47:12 +0200 Subject: [PATCH] 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 --- themes/xresources/assets.lua | 7 ++++--- themes/xresources/theme.lua | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/themes/xresources/assets.lua b/themes/xresources/assets.lua index 98803078..e7a7db72 100644 --- a/themes/xresources/assets.lua +++ b/themes/xresources/assets.lua @@ -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) diff --git a/themes/xresources/theme.lua b/themes/xresources/theme.lua index 50791479..a1cea1a2 100644 --- a/themes/xresources/theme.lua +++ b/themes/xresources/theme.lua @@ -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