awesomerc/theme/init.lua

99 lines
2.8 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 icons_dir = assets_dir .. 'icons/'
local theme = {}
--- Basic
theme.font = 'Noto Mono 9'
--- Tags
theme.hometag_master_width_factor = 0.65
--- Icons
theme.icon_hometag = icons_dir .. 'home-circle.svg'
theme.icon_apps = icons_dir .. 'apps.svg'
theme.icon_battery_outline = icons_dir .. 'battery-outline.svg'
--- Wibar
-- My wibar is a transparent dock at the bottom of the screen.
-- Height and width ahve to be set by the constructor to use screen DPI and
-- screen percentage values.
theme.wibar_stretch = false
theme.wibar_border_width = 0
theme.wibar_border_color = nil
theme.wibar_ontop = false
theme.wibar_opacity = 1
theme.wibar_type = 'dock'
theme.wibar_bg = '#0000'
--- Spacing and margins
-- Naming convention:
-- <rc.ui.desktop_decoration element>_<widget element>_<property>
theme.spacing = 8
theme.margin = 4
theme.padding = 4
theme.bar_height = 32 + (theme.margin * 2) -- This is the outer size of the bar
theme.bar_width = '80%' -- Make the bar size relative to the screen
theme.bar_margin_x = theme.margin * 2
theme.bar_margin_y = theme.margin
theme.bar_padding_x = theme.padding * 2
theme.bar_padding_y = 0
theme.bar_box_margin_x = 0
theme.bar_box_margin_y = theme.margin
theme.bar_box_padding_x = theme.padding * 2
theme.bar_box_padding_y = theme.padding
theme.bar_box_spacing = theme.spacing
--- Widgets specific
theme.bg_systray = '#455A64'
theme.systray_icon_spacing = 3
--- 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