Merge pull request #858 from psychon/wallpaper-function
Wallpaper function
This commit is contained in:
commit
cf4324fd5f
|
@ -168,7 +168,12 @@ mytasklist.buttons = awful.util.table.join(
|
||||||
awful.screen.connect_for_each_screen(function(s)
|
awful.screen.connect_for_each_screen(function(s)
|
||||||
-- Wallpaper
|
-- Wallpaper
|
||||||
if beautiful.wallpaper then
|
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
|
end
|
||||||
|
|
||||||
-- Each screen has its own tag table.
|
-- Each screen has its own tag table.
|
||||||
|
|
|
@ -47,10 +47,12 @@ 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 img = cairo.ImageSurface(cairo.Format.ARGB32, width, 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 cr = cairo.Context(img)
|
||||||
|
|
||||||
local letter_size = height/10
|
local letter_size = height/10
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue