Merge pull request #858 from psychon/wallpaper-function

Wallpaper function
This commit is contained in:
Daniel Hahler 2016-04-30 15:53:13 +02:00
commit cf4324fd5f
3 changed files with 15 additions and 8 deletions

View File

@ -168,7 +168,12 @@ mytasklist.buttons = awful.util.table.join(
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
if beautiful.wallpaper then
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
gears.wallpaper.maximized(wallpaper, s, true)
end
-- Each screen has its own tag table.

View File

@ -47,10 +47,12 @@ 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
local img = cairo.ImageSurface(cairo.Format.ARGB32, width, height)
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.RecordingSurface(cairo.Content.COLOR,
cairo.Rectangle { x = 0, y = 0, width = width, height = height })
local cr = cairo.Context(img)
local letter_size = height/10

View File

@ -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