local awful = require("awful")
local gears = require("gears")

local _W = {}

function _W.set_wallpaper(s)
    local wallpaper = require("theme.wallpaper")

    if type(wallpaper) == "function" then
      wallpaper = wallpaper(s)
    end
    gears.wallpaper.maximized(wallpaper, s, true)
end

screen.connect_signal("property::geometry", _W.set_wallpaper)

return setmetatable({}, {
	__call = function(_, ...)
		return _W.set_wallpaper(...)
	end,
})
