53 lines
1.5 KiB
Lua
53 lines
1.5 KiB
Lua
local gfs = require 'gears.filesystem'
|
|
|
|
local config_dir = gfs.get_configuration_dir()
|
|
local theme_dir = config_dir .. 'theme/'
|
|
local assets_dir = theme_dir .. 'assets/'
|
|
|
|
local theme = {}
|
|
|
|
theme.border_color_normal = '#0000ff'
|
|
|
|
--- Wallpaper
|
|
theme.wallpaper = function (screen)
|
|
local cairo = require('lgi').cairo
|
|
local surface = require 'gears.surface'
|
|
local wallpaper = require 'gears.wallpaper'
|
|
|
|
local wallpaper_image_path = assets_dir .. 'wallpapers/pizza.jpg'
|
|
|
|
local geom, cr = wallpaper.prepare_context(screen)
|
|
-- local surf = cairo.ImageSurface.create(cairo.Format.RGB24, 200, 200)
|
|
local surf = surface.load_uncached(wallpaper_image_path)
|
|
local w, h = surface.get_size(surf)
|
|
local aspect_w = geom.width / w
|
|
local aspect_h = geom.height / h
|
|
|
|
-- scall the surface to the screen dimenssion ignoring aspect ratio
|
|
cr:scale(aspect_w, aspect_h)
|
|
cr:set_source_surface(surf, 0, 0)
|
|
cr:paint()
|
|
|
|
-- Add colored layer
|
|
local cm = cairo.LinearPattern(0, 0, w, h)
|
|
cm:add_color_stop_rgba(0, 38/256, 50/256, 56/256, 0.2)
|
|
cr:set_source(cm)
|
|
cr:paint()
|
|
|
|
-- Add vignette effect
|
|
local linpat = cairo.LinearPattern(0, 0, w, h)
|
|
linpat:add_color_stop_rgba(0, 0, 0, 0, 1)
|
|
local radpat = cairo.RadialPattern(
|
|
w / 2, h / 2, h * 0.5,
|
|
w / 2, h / 2, w * 0.5)
|
|
for i=0,1,0.1 do
|
|
radpat:add_color_stop_rgba(i, 0, 0, 0, i/2)
|
|
end
|
|
cr:set_source(linpat)
|
|
cr:mask(radpat)
|
|
|
|
surf:finish()
|
|
end
|
|
|
|
return theme
|