move `theme_assets` from xresources theme to `beautiful` module. (#1219)
This commit is contained in:
parent
18cb05d232
commit
316734a681
|
@ -20,8 +20,13 @@ local gears_debug = require("gears.debug")
|
|||
local protected_call = require("gears.protected_call")
|
||||
|
||||
local xresources = require("beautiful.xresources")
|
||||
local theme_assets = require("beautiful.theme_assets")
|
||||
|
||||
local beautiful = { xresources = xresources, mt = {} }
|
||||
local beautiful = {
|
||||
xresources = xresources,
|
||||
theme_assets = theme_assets,
|
||||
mt = {}
|
||||
}
|
||||
|
||||
-- Local data
|
||||
local theme = {}
|
||||
|
|
|
@ -0,0 +1,283 @@
|
|||
----------------------------------------------------------------------------
|
||||
--- Generate vector assets using current colors.
|
||||
--
|
||||
-- @author Yauhen Kirylau <yawghen@gmail.com>
|
||||
-- @copyright 2015 Yauhen Kirylau
|
||||
-- @module beautiful.theme_assets
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
local cairo = require("lgi").cairo
|
||||
local gears_color = require("gears.color")
|
||||
local recolor_image = gears_color.recolor_image
|
||||
local screen = screen
|
||||
|
||||
local theme_assets = {}
|
||||
|
||||
|
||||
--- Generate selected taglist square.
|
||||
-- @tparam number size Size.
|
||||
-- @tparam color fg Background color.
|
||||
-- @return Image with the square.
|
||||
function theme_assets.taglist_squares_sel(size, fg)
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
|
||||
local cr = cairo.Context(img)
|
||||
cr:set_source(gears_color(fg))
|
||||
cr:paint()
|
||||
return img
|
||||
end
|
||||
|
||||
--- Generate unselected taglist square.
|
||||
-- @tparam number size Size.
|
||||
-- @tparam color fg Background color.
|
||||
-- @return Image with the square.
|
||||
function theme_assets.taglist_squares_unsel(size, fg)
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
|
||||
local cr = cairo.Context(img)
|
||||
cr:set_source(gears_color(fg))
|
||||
cr:set_line_width(size/4)
|
||||
cr:rectangle(0, 0, size, size)
|
||||
cr:stroke()
|
||||
return img
|
||||
end
|
||||
|
||||
local function make_letter(cr, n, lines, size, bg, fg, alt_fg)
|
||||
local letter_gap = size/6
|
||||
|
||||
local function make_line(coords)
|
||||
for i, coord in ipairs(coords) do
|
||||
if i == 1 then
|
||||
cr:rel_move_to(coord[1], coord[2])
|
||||
else
|
||||
cr:rel_line_to(coord[1], coord[2])
|
||||
end
|
||||
end
|
||||
cr:stroke()
|
||||
end
|
||||
|
||||
lines = lines or {}
|
||||
local color = alt_fg or fg
|
||||
cr:set_source(gears_color(color))
|
||||
cr:rectangle(
|
||||
0, (size+letter_gap)*n,
|
||||
size, size
|
||||
)
|
||||
cr:fill()
|
||||
|
||||
if bg then
|
||||
cr:set_source(gears_color(bg))
|
||||
else
|
||||
cr:set_operator(cairo.Operator.CLEAR)
|
||||
end
|
||||
|
||||
for _, line in ipairs(lines) do
|
||||
cr:move_to(0, (size+letter_gap)*n)
|
||||
make_line(line)
|
||||
end
|
||||
|
||||
cr:set_operator(cairo.Operator.OVER)
|
||||
end
|
||||
|
||||
--- Put Awesome WM name onto cairo surface.
|
||||
-- @param cr Cairo surface.
|
||||
-- @tparam number height Height.
|
||||
-- @tparam color bg Background color.
|
||||
-- @tparam color fg Main foreground color.
|
||||
-- @tparam color alt_fg Accent foreground color.
|
||||
function theme_assets.gen_awesome_name(cr, height, bg, fg, alt_fg)
|
||||
local ls = height/10 -- letter_size
|
||||
local letter_line = ls/18
|
||||
|
||||
cr:set_line_width(letter_line)
|
||||
|
||||
-- a
|
||||
make_letter(cr, 0, { {
|
||||
{ 0, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls/3, 0 },
|
||||
{ 0, ls/3 },
|
||||
} }, ls, bg, fg, alt_fg)
|
||||
-- w
|
||||
make_letter(cr, 1, { {
|
||||
{ ls/3, 0 },
|
||||
{ 0,ls*2/3 },
|
||||
}, {
|
||||
{ ls*2/3, 0 },
|
||||
{ 0,ls*2/3 },
|
||||
} }, ls, bg, fg)
|
||||
-- e
|
||||
make_letter(cr, 2, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls*2/3, 0 },
|
||||
} }, ls, bg, fg)
|
||||
-- s
|
||||
make_letter(cr, 3, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ 0, ls*2/3 },
|
||||
{ ls*2/3, 0 },
|
||||
} }, ls, bg, fg)
|
||||
-- o
|
||||
make_letter(cr, 4, { {
|
||||
{ ls/2, ls/3 },
|
||||
{ 0, ls/3 },
|
||||
} }, ls, bg, fg)
|
||||
-- m
|
||||
make_letter(cr, 5, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ 0,ls*2/3 },
|
||||
}, {
|
||||
{ ls*2/3, ls/3 },
|
||||
{ 0,ls*2/3 },
|
||||
} }, ls, bg, fg)
|
||||
-- e
|
||||
make_letter(cr, 6, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls*2/3, 0 },
|
||||
} }, ls, bg, fg)
|
||||
end
|
||||
|
||||
--- Put Awesome WM logo onto cairo surface.
|
||||
-- @param cr Cairo surface.
|
||||
-- @tparam number width Width.
|
||||
-- @tparam number height Height.
|
||||
-- @tparam color bg Background color.
|
||||
-- @tparam color fg Foreground color.
|
||||
function theme_assets.gen_logo(cr, width, height, bg, fg)
|
||||
local ls = math.min(width, height)
|
||||
|
||||
local letter_line = ls/18
|
||||
|
||||
cr:set_line_width(letter_line)
|
||||
|
||||
make_letter(cr, 0, { {
|
||||
{ 0, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls/3, 0 },
|
||||
{ 0, ls/3 },
|
||||
} }, ls, bg, fg)
|
||||
end
|
||||
|
||||
--- Generate Awesome WM logo.
|
||||
-- @tparam number size Size.
|
||||
-- @tparam color bg Background color.
|
||||
-- @tparam color fg Background color.
|
||||
-- @return Image with the logo.
|
||||
function theme_assets.awesome_icon(size, bg, fg)
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
|
||||
local cr = cairo.Context(img)
|
||||
theme_assets.gen_logo(cr, size, size, fg, bg)
|
||||
return img
|
||||
end
|
||||
|
||||
--- Generate Awesome WM wallpaper.
|
||||
-- @tparam color bg Background color.
|
||||
-- @tparam color fg Main foreground color.
|
||||
-- @tparam color alt_fg Accent foreground color.
|
||||
-- @tparam screen s Screen (to get wallpaper size).
|
||||
-- @return Wallpaper image.
|
||||
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_start_x = width - width / 10
|
||||
local letter_start_y = height / 10
|
||||
cr:translate(letter_start_x, letter_start_y)
|
||||
|
||||
-- background
|
||||
cr:set_source(gears_color(bg))
|
||||
cr:paint()
|
||||
|
||||
theme_assets.gen_awesome_name(cr, height, bg, fg, alt_fg)
|
||||
|
||||
return img
|
||||
end
|
||||
|
||||
--- Recolor unfocused titlebar icons.
|
||||
-- @tparam table theme Beautiful theme table
|
||||
-- @tparam color color Icons' color.
|
||||
-- @treturn table Beautiful theme table with the images recolored.
|
||||
function theme_assets.recolor_titlebar_normal(theme, color)
|
||||
for _, titlebar_icon in ipairs({
|
||||
'titlebar_close_button_normal',
|
||||
'titlebar_minimize_button_normal',
|
||||
'titlebar_ontop_button_normal_inactive',
|
||||
'titlebar_ontop_button_normal_active',
|
||||
'titlebar_sticky_button_normal_inactive',
|
||||
'titlebar_sticky_button_normal_active',
|
||||
'titlebar_floating_button_normal_inactive',
|
||||
'titlebar_floating_button_normal_active',
|
||||
'titlebar_maximized_button_normal_inactive',
|
||||
'titlebar_maximized_button_normal_active',
|
||||
}) do
|
||||
theme[titlebar_icon] = recolor_image(theme[titlebar_icon], color)
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
--- Recolor focused titlebar icons.
|
||||
-- @tparam table theme Beautiful theme table
|
||||
-- @tparam color color Icons' color.
|
||||
-- @treturn table Beautiful theme table with the images recolored.
|
||||
function theme_assets.recolor_titlebar_focus(theme, color)
|
||||
for _, titlebar_icon in ipairs({
|
||||
'titlebar_close_button_focus',
|
||||
'titlebar_minimize_button_focus',
|
||||
'titlebar_ontop_button_focus_inactive',
|
||||
'titlebar_ontop_button_focus_active',
|
||||
'titlebar_sticky_button_focus_inactive',
|
||||
'titlebar_sticky_button_focus_active',
|
||||
'titlebar_floating_button_focus_inactive',
|
||||
'titlebar_floating_button_focus_active',
|
||||
'titlebar_maximized_button_focus_inactive',
|
||||
'titlebar_maximized_button_focus_active',
|
||||
}) do
|
||||
theme[titlebar_icon] = recolor_image(theme[titlebar_icon], color)
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
--- Recolor layout icons.
|
||||
-- @tparam table theme Beautiful theme table
|
||||
-- @tparam color color Icons' color.
|
||||
-- @treturn table Beautiful theme table with the images recolored.
|
||||
function theme_assets.recolor_layout(theme, color)
|
||||
for _, layout_name in ipairs({
|
||||
'layout_fairh',
|
||||
'layout_fairv',
|
||||
'layout_floating',
|
||||
'layout_magnifier',
|
||||
'layout_max',
|
||||
'layout_fullscreen',
|
||||
'layout_tilebottom',
|
||||
'layout_tileleft',
|
||||
'layout_tile',
|
||||
'layout_tiletop',
|
||||
'layout_spiral',
|
||||
'layout_dwindle',
|
||||
'layout_cornernw',
|
||||
'layout_cornerne',
|
||||
'layout_cornersw',
|
||||
'layout_cornerse',
|
||||
}) do
|
||||
theme[layout_name] = recolor_image(theme[layout_name], color)
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
return theme_assets
|
||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -1,13 +1,15 @@
|
|||
local parent = ... --DOC_HIDE
|
||||
local wibox = require( "wibox" ) --DOC_HIDE
|
||||
local assets = require( "xresources.assets" ) --DOC_HIDE
|
||||
local assets = require( "beautiful.theme_assets" ) --DOC_HIDE
|
||||
|
||||
local size = 128 --DOC_HIDE
|
||||
|
||||
parent:add( --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
fit = function() return 128, 128 end,
|
||||
fit = function() return size, size end,
|
||||
draw = function(_, _, cr)
|
||||
assets.gen_logo(cr, 128, 128, nil, "#535d6c")
|
||||
assets.gen_logo(cr, size, size, nil, "#535d6c")
|
||||
end,
|
||||
widget = wibox.widget.base.make_widget
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
local parent = ... --DOC_HIDE
|
||||
local wibox = require( "wibox" ) --DOC_HIDE
|
||||
local assets = require( "xresources.assets" ) --DOC_HIDE
|
||||
local assets = require( "beautiful.theme_assets" ) --DOC_HIDE
|
||||
|
||||
local size = 128 --DOC_HIDE
|
||||
|
||||
parent:add( --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
fit = function() return 148, 128 end,
|
||||
fit = function() return size+20, size end,
|
||||
draw = function(_, _, cr)
|
||||
assets.gen_logo(cr, 128, 128, nil, "#535d6c")
|
||||
cr:translate(128 + 128/16, 0)
|
||||
assets.gen_awesome_name(cr, 158, nil, "#535d6c", nil)
|
||||
assets.gen_logo(cr, size, size, nil, "#535d6c")
|
||||
cr:translate(size + size/16, 0)
|
||||
assets.gen_awesome_name(cr, size+30, nil, "#535d6c", nil)
|
||||
end,
|
||||
widget = wibox.widget.base.make_widget
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 187 B |
Binary file not shown.
Before Width: | Height: | Size: 193 B |
|
@ -2,11 +2,14 @@
|
|||
-- Default awesome theme --
|
||||
---------------------------
|
||||
|
||||
local theme = {}
|
||||
local theme_assets = require("beautiful.theme_assets")
|
||||
local xresources = require("beautiful.xresources")
|
||||
local dpi = xresources.apply_dpi
|
||||
|
||||
local util = require('awful.util')
|
||||
local themes_path = util.get_themes_dir()
|
||||
local icon_path = util.get_awesome_icon_dir()
|
||||
|
||||
local theme = {}
|
||||
|
||||
theme.font = "sans 8"
|
||||
|
||||
|
@ -22,7 +25,7 @@ theme.fg_urgent = "#ffffff"
|
|||
theme.fg_minimize = "#ffffff"
|
||||
|
||||
theme.useless_gap = 0
|
||||
theme.border_width = 1
|
||||
theme.border_width = dpi(1)
|
||||
theme.border_normal = "#000000"
|
||||
theme.border_focus = "#535d6c"
|
||||
theme.border_marked = "#91231c"
|
||||
|
@ -38,16 +41,21 @@ theme.border_marked = "#91231c"
|
|||
-- Example:
|
||||
--theme.taglist_bg_focus = "#ff0000"
|
||||
|
||||
-- Display the taglist squares
|
||||
theme.taglist_squares_sel = themes_path.."default/taglist/squarefw.png"
|
||||
theme.taglist_squares_unsel = themes_path.."default/taglist/squarew.png"
|
||||
-- Generate taglist squares:
|
||||
local taglist_square_size = dpi(4)
|
||||
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
|
||||
taglist_square_size, theme.fg_normal
|
||||
)
|
||||
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
|
||||
taglist_square_size, theme.fg_normal
|
||||
)
|
||||
|
||||
-- Variables set for theming the menu:
|
||||
-- menu_[bg|fg]_[normal|focus]
|
||||
-- menu_[border_color|border_width]
|
||||
theme.menu_submenu_icon = themes_path.."default/submenu.png"
|
||||
theme.menu_height = 15
|
||||
theme.menu_width = 100
|
||||
theme.menu_height = dpi(15)
|
||||
theme.menu_width = dpi(100)
|
||||
|
||||
-- You can add as many variables as
|
||||
-- you wish and access them by using
|
||||
|
@ -101,7 +109,10 @@ theme.layout_cornerne = themes_path.."default/layouts/cornernew.png"
|
|||
theme.layout_cornersw = themes_path.."default/layouts/cornersww.png"
|
||||
theme.layout_cornerse = themes_path.."default/layouts/cornersew.png"
|
||||
|
||||
theme.awesome_icon = icon_path.."awesome16.png"
|
||||
-- Generate Awesome icon:
|
||||
theme.awesome_icon = theme_assets.awesome_icon(
|
||||
theme.menu_height, theme.bg_focus, theme.fg_focus
|
||||
)
|
||||
|
||||
-- Define the icon theme for application icons. If not set then the icons
|
||||
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
-------------------------------
|
||||
-- If you want SVGs and extras, get them from garoth.com/awesome/sky-theme
|
||||
|
||||
local theme_assets = require("beautiful.theme_assets")
|
||||
local xresources = require("beautiful.xresources")
|
||||
local dpi = xresources.apply_dpi
|
||||
|
||||
|
||||
-- BASICS
|
||||
local theme = {}
|
||||
theme.font = "sans 8"
|
||||
|
@ -20,7 +25,7 @@ theme.fg_urgent = "#2e3436"
|
|||
theme.fg_minimize = "#2e3436"
|
||||
|
||||
theme.useless_gap = 0
|
||||
theme.border_width = 2
|
||||
theme.border_width = dpi(2)
|
||||
theme.border_normal = "#dae3e0"
|
||||
theme.border_focus = "#729fcf"
|
||||
theme.border_marked = "#eeeeec"
|
||||
|
@ -47,15 +52,22 @@ theme.awesome_icon = "@AWESOME_THEMES_PATH@/sky/awesome-icon.png"
|
|||
|
||||
-- from default for now...
|
||||
theme.menu_submenu_icon = "@AWESOME_THEMES_PATH@/default/submenu.png"
|
||||
theme.taglist_squares_sel = "@AWESOME_THEMES_PATH@/default/taglist/squarefw.png"
|
||||
theme.taglist_squares_unsel = "@AWESOME_THEMES_PATH@/default/taglist/squarew.png"
|
||||
|
||||
-- Generate taglist squares:
|
||||
local taglist_square_size = dpi(4)
|
||||
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
|
||||
taglist_square_size, theme.fg_normal
|
||||
)
|
||||
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
|
||||
taglist_square_size, theme.fg_normal
|
||||
)
|
||||
|
||||
-- MISC
|
||||
theme.wallpaper = "@AWESOME_THEMES_PATH@/sky/sky-background.png"
|
||||
theme.taglist_squares = "true"
|
||||
theme.titlebar_close_button = "true"
|
||||
theme.menu_height = 15
|
||||
theme.menu_width = 100
|
||||
theme.menu_height = dpi(15)
|
||||
theme.menu_width = dpi(100)
|
||||
|
||||
-- Define the image to load
|
||||
theme.titlebar_close_button_normal = "@AWESOME_THEMES_PATH@/default/titlebar/close_normal.png"
|
||||
|
|
|
@ -1,250 +1,2 @@
|
|||
--------------------------------------------------
|
||||
-- Generate vector assets using current colors: --
|
||||
-- (2015) Yauhen Kirylau --
|
||||
--------------------------------------------------
|
||||
|
||||
local cairo = require("lgi").cairo
|
||||
local gears = require("gears")
|
||||
local recolor_image = gears.color.recolor_image
|
||||
local screen = screen
|
||||
|
||||
local theme_assets = {}
|
||||
|
||||
|
||||
function theme_assets.awesome_icon(size, bg, fg)
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
|
||||
local cr = cairo.Context(img)
|
||||
cr:set_source(gears.color(bg))
|
||||
cr:paint()
|
||||
cr:set_source(gears.color(fg))
|
||||
cr:set_line_width(size/20)
|
||||
cr:move_to(0, size/3)
|
||||
cr:line_to(size*2/3, size/3)
|
||||
cr:move_to(size/3, size*2/3)
|
||||
cr:line_to(size*2/3, size*2/3)
|
||||
cr:line_to(size*2/3, size)
|
||||
cr:stroke()
|
||||
return img
|
||||
end
|
||||
|
||||
-- Taglist squares:
|
||||
function theme_assets.taglist_squares_sel(size, fg)
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
|
||||
local cr = cairo.Context(img)
|
||||
cr:set_source(gears.color(fg))
|
||||
cr:paint()
|
||||
return img
|
||||
end
|
||||
|
||||
function theme_assets.taglist_squares_unsel(size, fg)
|
||||
local img = cairo.ImageSurface(cairo.Format.ARGB32, size, size)
|
||||
local cr = cairo.Context(img)
|
||||
cr:set_source(gears.color(fg))
|
||||
cr:set_line_width(size/4)
|
||||
cr:rectangle(0, 0, size, size)
|
||||
cr:stroke()
|
||||
return img
|
||||
end
|
||||
|
||||
local function make_letter(cr, n, lines, size, bg, fg, alt_fg)
|
||||
local letter_gap = size/6
|
||||
|
||||
local function make_line(coords)
|
||||
for i, coord in ipairs(coords) do
|
||||
if i == 1 then
|
||||
cr:rel_move_to(coord[1], coord[2])
|
||||
else
|
||||
cr:rel_line_to(coord[1], coord[2])
|
||||
end
|
||||
end
|
||||
cr:stroke()
|
||||
end
|
||||
|
||||
lines = lines or {}
|
||||
local color = alt_fg or fg
|
||||
cr:set_source(gears.color(color))
|
||||
cr:rectangle(
|
||||
0, (size+letter_gap)*n,
|
||||
size, size
|
||||
)
|
||||
cr:fill()
|
||||
|
||||
if bg then
|
||||
cr:set_source(gears.color(bg))
|
||||
else
|
||||
cr:set_operator(cairo.Operator.CLEAR)
|
||||
end
|
||||
|
||||
for _, line in ipairs(lines) do
|
||||
cr:move_to(0, (size+letter_gap)*n)
|
||||
make_line(line)
|
||||
end
|
||||
|
||||
cr:set_operator(cairo.Operator.OVER)
|
||||
end
|
||||
|
||||
function theme_assets.gen_awesome_name(cr, height, bg, fg, alt_fg)
|
||||
local ls = height/10 -- letter_size
|
||||
local letter_line = ls/18
|
||||
|
||||
cr:set_line_width(letter_line)
|
||||
|
||||
-- a
|
||||
make_letter(cr, 0, { {
|
||||
{ 0, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls/3, 0 },
|
||||
{ 0, ls/3 },
|
||||
} }, ls, bg, fg, alt_fg)
|
||||
-- w
|
||||
make_letter(cr, 1, { {
|
||||
{ ls/3, 0 },
|
||||
{ 0,ls*2/3 },
|
||||
}, {
|
||||
{ ls*2/3, 0 },
|
||||
{ 0,ls*2/3 },
|
||||
} }, ls, bg, fg)
|
||||
-- e
|
||||
make_letter(cr, 2, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls*2/3, 0 },
|
||||
} }, ls, bg, fg)
|
||||
-- s
|
||||
make_letter(cr, 3, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ 0, ls*2/3 },
|
||||
{ ls*2/3, 0 },
|
||||
} }, ls, bg, fg)
|
||||
-- o
|
||||
make_letter(cr, 4, { {
|
||||
{ ls/2, ls/3 },
|
||||
{ 0, ls/3 },
|
||||
} }, ls, bg, fg)
|
||||
-- m
|
||||
make_letter(cr, 5, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ 0,ls*2/3 },
|
||||
}, {
|
||||
{ ls*2/3, ls/3 },
|
||||
{ 0,ls*2/3 },
|
||||
} }, ls, bg, fg)
|
||||
-- e
|
||||
make_letter(cr, 6, { {
|
||||
{ ls/3, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls*2/3, 0 },
|
||||
} }, ls, bg, fg)
|
||||
end
|
||||
|
||||
function theme_assets.gen_logo(cr, width, height, bg, fg)
|
||||
local ls = math.min(width, height)
|
||||
|
||||
local letter_line = ls/18
|
||||
|
||||
cr:set_line_width(letter_line)
|
||||
|
||||
make_letter(cr, 0, { {
|
||||
{ 0, ls/3 },
|
||||
{ ls*2/3, 0 },
|
||||
}, {
|
||||
{ ls/3, ls*2/3 },
|
||||
{ ls/3, 0 },
|
||||
{ 0, ls/3 },
|
||||
} }, ls, bg, fg)
|
||||
end
|
||||
|
||||
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_start_x = width - width / 10
|
||||
local letter_start_y = height / 10
|
||||
cr:translate(letter_start_x, letter_start_y)
|
||||
|
||||
-- background
|
||||
cr:set_source(gears.color(bg))
|
||||
cr:paint()
|
||||
|
||||
theme_assets.gen_awesome_name(cr, height, bg, fg, alt_fg)
|
||||
|
||||
return img
|
||||
end
|
||||
|
||||
-- Recolor titlebar icons:
|
||||
|
||||
function theme_assets.recolor_titlebar_normal(theme, color)
|
||||
for _, titlebar_icon in ipairs({
|
||||
'titlebar_close_button_normal',
|
||||
'titlebar_minimize_button_normal',
|
||||
'titlebar_ontop_button_normal_inactive',
|
||||
'titlebar_ontop_button_normal_active',
|
||||
'titlebar_sticky_button_normal_inactive',
|
||||
'titlebar_sticky_button_normal_active',
|
||||
'titlebar_floating_button_normal_inactive',
|
||||
'titlebar_floating_button_normal_active',
|
||||
'titlebar_maximized_button_normal_inactive',
|
||||
'titlebar_maximized_button_normal_active',
|
||||
}) do
|
||||
theme[titlebar_icon] = recolor_image(theme[titlebar_icon], color)
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
function theme_assets.recolor_titlebar_focus(theme, color)
|
||||
for _, titlebar_icon in ipairs({
|
||||
'titlebar_close_button_focus',
|
||||
'titlebar_minimize_button_focus',
|
||||
'titlebar_ontop_button_focus_inactive',
|
||||
'titlebar_ontop_button_focus_active',
|
||||
'titlebar_sticky_button_focus_inactive',
|
||||
'titlebar_sticky_button_focus_active',
|
||||
'titlebar_floating_button_focus_inactive',
|
||||
'titlebar_floating_button_focus_active',
|
||||
'titlebar_maximized_button_focus_inactive',
|
||||
'titlebar_maximized_button_focus_active',
|
||||
}) do
|
||||
theme[titlebar_icon] = recolor_image(theme[titlebar_icon], color)
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
-- Recolor layout icons:
|
||||
function theme_assets.recolor_layout(theme, color)
|
||||
for _, layout_name in ipairs({
|
||||
'layout_fairh',
|
||||
'layout_fairv',
|
||||
'layout_floating',
|
||||
'layout_magnifier',
|
||||
'layout_max',
|
||||
'layout_fullscreen',
|
||||
'layout_tilebottom',
|
||||
'layout_tileleft',
|
||||
'layout_tile',
|
||||
'layout_tiletop',
|
||||
'layout_spiral',
|
||||
'layout_dwindle',
|
||||
'layout_cornernw',
|
||||
'layout_cornerne',
|
||||
'layout_cornersw',
|
||||
'layout_cornerse',
|
||||
}) do
|
||||
theme[layout_name] = recolor_image(theme[layout_name], color)
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
return theme_assets
|
||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||
require("awful.util").deprecate("Use beautiful.theme_assets instead.")
|
||||
return require("beautiful.theme_assets")
|
||||
|
|
|
@ -3,14 +3,16 @@
|
|||
-- by Yauhen Kirylau --
|
||||
---------------------------------------------
|
||||
|
||||
local xresources = require("beautiful").xresources
|
||||
local xrdb = xresources.get_current_theme()
|
||||
local theme_assets = require("beautiful.theme_assets")
|
||||
local xresources = require("beautiful.xresources")
|
||||
local dpi = xresources.apply_dpi
|
||||
local xrdb = xresources.get_current_theme()
|
||||
local util = require('awful.util')
|
||||
local themes_path = util.get_themes_dir()
|
||||
|
||||
-- inherit default theme
|
||||
local theme = dofile("@AWESOME_THEMES_PATH@/default/theme.lua")
|
||||
local theme = dofile(themes_path.."default/theme.lua")
|
||||
-- load vector assets' generators for this theme
|
||||
local theme_assets = dofile("@AWESOME_THEMES_PATH@/xresources/assets.lua")
|
||||
|
||||
theme.font = "sans 8"
|
||||
|
||||
|
@ -48,7 +50,7 @@ theme.tooltip_bg = theme.bg_normal
|
|||
-- Variables set for theming the menu:
|
||||
-- menu_[bg|fg]_[normal|focus]
|
||||
-- menu_[border_color|border_width]
|
||||
theme.menu_submenu_icon = "@AWESOME_THEMES_PATH@/default/submenu.png"
|
||||
theme.menu_submenu_icon = themes_path.."default/submenu.png"
|
||||
theme.menu_height = dpi(16)
|
||||
theme.menu_width = dpi(100)
|
||||
|
||||
|
|
Loading…
Reference in New Issue