2023-05-27 14:57:46 +00:00
-- This file is part of Reno desktop.
2022-08-31 12:20:58 +00:00
--
2023-05-27 14:57:46 +00:00
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
2022-08-31 12:20:58 +00:00
--
2023-05-27 14:57:46 +00:00
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
2022-08-31 12:20:58 +00:00
--
2023-05-27 14:57:46 +00:00
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
2022-10-24 11:19:57 +00:00
-- renotk (formerly awmtk2) - template/granular styling library for reno
2022-07-12 21:26:11 +00:00
local wibox = require ( " wibox " )
local gears = require ( " gears " )
local beautiful = require ( " beautiful " )
2022-09-05 21:54:11 +00:00
beautiful.widgets = beautiful.widgets or { }
beautiful.templates = beautiful.templates or { }
2022-07-12 21:26:11 +00:00
local awmtk = { }
2022-10-24 11:19:57 +00:00
-- {{{ utils
2023-01-19 13:42:20 +00:00
awmtk.create_delta = function ( name , instance_delta , class_delta , parent_delta , vertical )
2022-10-24 11:19:57 +00:00
-- to save memory, we create proxies for lower layers called "deltas"
-- this function creates that proxy layer using metatables
-- fun story - i used instance_delta instead of {} at first.
-- the results were horrifying and confusing.
2022-08-11 19:34:25 +00:00
return setmetatable ( { } , {
2023-01-19 13:42:20 +00:00
__index = function ( _ , k )
2022-10-24 11:19:57 +00:00
-- per-instance overrides are top priority
2022-08-11 19:34:25 +00:00
if rawget ( instance_delta , k ) then
return rawget ( instance_delta , k )
2022-10-24 11:19:57 +00:00
-- class-wide overrides are second in priority
2022-12-10 22:28:22 +00:00
elseif type ( class_delta [ name ] ) == " table "
2022-07-23 19:10:02 +00:00
and rawget ( class_delta [ name ] , k ) then
2023-01-19 13:42:20 +00:00
if vertical and
type ( rawget ( class_delta [ name ] , " vertical " ) ) == " table " and
rawget ( class_delta [ name ] , " vertical " ) [ k ] then
return rawget ( class_delta [ name ] . vertical , k )
else
return rawget ( class_delta [ name ] , k )
end
2022-10-24 11:19:57 +00:00
-- parent is fallback
2022-07-23 19:10:02 +00:00
elseif parent_delta [ k ] then
return parent_delta [ k ]
2022-07-12 21:26:11 +00:00
end
end
} )
end
2023-01-19 13:42:20 +00:00
awmtk.create_style = function ( name , parent , overrides , vertical )
2022-10-24 11:19:57 +00:00
-- a style is essentially a layer of deltas upon the previous (parent) style
2022-07-12 21:26:11 +00:00
local new_style = { }
2022-08-11 19:34:25 +00:00
local odelta = ( overrides and overrides [ name ] ) or { }
2022-09-05 21:54:11 +00:00
local cdelta = beautiful.widgets [ name ] or { }
2023-01-19 13:42:20 +00:00
for class_name , parent_class in pairs ( parent ) do
new_style [ class_name ] = awmtk.create_delta (
class_name ,
2022-08-11 19:34:25 +00:00
odelta ,
cdelta ,
2023-01-19 13:42:20 +00:00
parent_class ,
vertical
2022-07-12 21:26:11 +00:00
)
end
return new_style
2022-12-10 22:28:22 +00:00
end
2022-07-12 21:26:11 +00:00
2022-07-23 19:10:02 +00:00
awmtk.create_template_lib = function ( name , parent , overrides )
-- same thing but beautiful.templates
return awmtk.create_delta (
name ,
overrides or { } ,
beautiful.templates or { } ,
parent
)
end
2023-01-16 12:47:51 +00:00
awmtk.build_templates = function ( templates , style , vertical )
2022-07-23 19:10:02 +00:00
local new_templates = { }
2023-01-19 13:42:20 +00:00
for name , _ in pairs ( awmtk.proto_templates ) do
2023-01-16 12:47:51 +00:00
new_templates [ name ] = templates [ name ] ( style , vertical )
2022-07-23 19:10:02 +00:00
end
return new_templates
end
2022-10-24 11:19:57 +00:00
awmtk.mask_object_call = function ( obj , call )
local new = { }
for k , v in pairs ( obj ) do
new [ k ] = v
end
return setmetatable ( new , {
__index = obj ,
__call = call
} )
end
awmtk.wrap_hooks = function ( w , callbacks )
2022-12-10 22:28:22 +00:00
-- attach hooks to function
local mcall = ( getmetatable ( w ) and getmetatable ( w ) . __call ) or w
local call_wrapper = function ( ... )
2022-10-24 11:19:57 +00:00
if callbacks and callbacks.on_create_pre then
callbacks.on_create_pre ( ... )
end
local widget = mcall ( ... )
if callbacks and callbacks.on_create then
callbacks.on_create ( widget , ... )
end
if callbacks and callbacks.on_ready then
2022-12-10 22:28:22 +00:00
callbacks._on_ready_called = false
2022-10-24 11:19:57 +00:00
local func = function ( )
2022-12-10 22:28:22 +00:00
if not callbacks._on_ready_called then
callbacks.on_ready ( widget )
callbacks._on_ready_called = true
end
2022-10-24 11:19:57 +00:00
end
widget : connect_signal ( " widget::layout_changed " , func )
widget : connect_signal ( " widget::layout_changed " , function ( )
widget : disconnect_signal ( " widget::layout_changed " , func )
end )
end
return widget
2022-12-10 22:28:22 +00:00
end
return ( getmetatable ( w ) and awmtk.mask_object_call ( w , call_wrapper ) ) or
call_wrapper
2022-10-24 11:19:57 +00:00
end
2022-08-21 12:28:28 +00:00
awmtk.merge = gears.table . join
2022-07-12 21:26:11 +00:00
-- }}}
2022-10-24 11:19:57 +00:00
-- {{{ default style
2022-07-12 21:26:11 +00:00
2022-10-24 11:19:57 +00:00
-- prototype style
-- notice that it's not awmtk.default style - it's used as a base for default.
2022-08-11 19:34:25 +00:00
awmtk.proto_style = {
2022-07-12 21:26:11 +00:00
base = setmetatable ( {
2022-10-24 11:19:57 +00:00
-- { backgrounds
2022-07-12 21:26:11 +00:00
-- custom background color for highlighting elements
bg_highlight = beautiful.bg_highlight or beautiful.bg_focus ,
2022-08-11 19:34:25 +00:00
-- allow more complex themes to define background images
bgimage_focus = beautiful.bgimage_focus ,
bgimage_normal = beautiful.bgimage_normal ,
2022-07-12 21:26:11 +00:00
-- }
2022-10-24 11:19:57 +00:00
-- { borders
-- borders for popups
2022-07-12 21:26:11 +00:00
shape_border_width = beautiful.shape_border_width or 0 ,
shape_border_color = beautiful.shape_border_color or beautiful.bg_normal ,
2022-08-21 12:28:28 +00:00
-- }
2022-10-24 11:19:57 +00:00
-- { callbacks
2022-08-11 19:34:25 +00:00
-- a tiny bit more complex thing to account for more extensibility
2023-08-16 19:40:39 +00:00
-- the stub functions do nothing - you should implement functionality inside the theme
2022-08-11 19:34:25 +00:00
onpress = function ( ) end ,
onrelease = function ( ) end ,
-- }
2022-10-24 11:19:57 +00:00
-- { shapes
2022-07-23 19:10:02 +00:00
margins = 5 ,
spacing = 5 ,
shape = function ( cr , width , height )
return require ( " gears " ) . shape.rounded_rect ( cr , width , height , 5 )
end ,
2022-07-12 21:26:11 +00:00
-- }
} , { __index = beautiful } )
}
2022-10-24 11:19:57 +00:00
-- subclasses
2022-08-11 19:34:25 +00:00
awmtk.proto_style . container = awmtk.create_delta ( " container " , {
} , awmtk.proto_style , awmtk.proto_style . base )
2022-07-12 21:26:11 +00:00
2022-08-11 19:34:25 +00:00
awmtk.proto_style . button = awmtk.create_delta ( " button " , {
2022-07-23 19:10:02 +00:00
margins = 3
2022-08-11 19:34:25 +00:00
} , awmtk.proto_style , awmtk.proto_style . base )
2022-07-12 21:26:11 +00:00
2022-08-11 19:34:25 +00:00
awmtk.proto_style . icon = awmtk.create_delta ( " icon " , {
2022-07-23 19:10:02 +00:00
margins = 1
2022-08-11 19:34:25 +00:00
} , awmtk.proto_style , awmtk.proto_style . base )
2022-07-12 21:26:11 +00:00
2022-08-11 19:34:25 +00:00
awmtk.proto_style . textbox = awmtk.create_delta ( " textbox " , {
2022-07-23 19:10:02 +00:00
font = beautiful.font or " sans 8 "
2022-08-11 19:34:25 +00:00
} , awmtk.proto_style , awmtk.proto_style . base )
2022-07-23 19:10:02 +00:00
2022-08-11 19:34:25 +00:00
awmtk.proto_style . separator = awmtk.create_delta ( " separator " , {
2022-07-23 19:10:02 +00:00
thickness = 1 ,
color = beautiful.bg_focus ,
border_width = 0
2022-08-11 19:34:25 +00:00
} , awmtk.proto_style , awmtk.proto_style . base )
2022-07-23 19:10:02 +00:00
2022-08-11 19:34:25 +00:00
awmtk.proto_style . article = awmtk.create_delta ( " article " , {
2022-07-23 19:10:02 +00:00
icon_size = 16 ,
2022-08-11 19:34:25 +00:00
small_font = beautiful.small_font or beautiful.font ,
2022-07-23 19:10:02 +00:00
font_align = " left " ,
small_font_align = " left "
2022-08-11 19:34:25 +00:00
} , awmtk.proto_style , awmtk.proto_style . base )
2022-07-23 19:10:02 +00:00
2022-08-11 19:34:25 +00:00
awmtk.proto_style . popup = awmtk.create_delta ( " popup " , {
} , awmtk.proto_style , awmtk.proto_style . base )
awmtk.proto_style . titlebar = awmtk.create_delta ( " titlebar " , {
margins = 1
} , awmtk.proto_style , awmtk.proto_style . base )
2022-08-21 12:28:28 +00:00
awmtk.proto_style . wibar = awmtk.create_delta ( " wibar " , {
margins = 1
} , awmtk.proto_style , awmtk.proto_style . base )
2022-08-23 13:03:15 +00:00
awmtk.proto_style . menu = awmtk.create_delta ( " menu " , {
margins = 1
} , awmtk.proto_style , awmtk.proto_style . base )
2022-08-30 07:00:35 +00:00
awmtk.proto_style . center = awmtk.create_delta ( " center " , {
margins = 1
} , awmtk.proto_style , awmtk.proto_style . base )
awmtk.proto_style . slider = awmtk.create_delta ( " slider " , {
margins = 1
} , awmtk.proto_style , awmtk.proto_style . base )
2022-09-16 18:42:50 +00:00
awmtk.proto_style . checkbox = awmtk.create_delta ( " checkbox " , {
} , awmtk.proto_style , awmtk.proto_style . base )
2023-01-19 13:42:20 +00:00
awmtk.proto_style . icon = awmtk.create_delta ( " icon " , {
constraint = " max " ,
height = 100 ,
width = 100 ,
valign = " center " ,
halign = " center " ,
margins = 0
} , awmtk.proto_style , awmtk.proto_style . base )
2022-08-11 19:34:25 +00:00
-- }}}
2022-07-12 21:26:11 +00:00
2022-10-24 11:19:57 +00:00
-- {{{ generic templates
2022-08-11 19:34:25 +00:00
awmtk.proto_templates = {
2022-10-24 11:19:57 +00:00
-- templates are built first using the given style, then applied to contents
2022-07-23 19:10:02 +00:00
-- through returned function
container = function ( style )
2022-10-24 11:19:57 +00:00
-- container is practically any "box" that contains buttons, textboxes,
-- and anything you want to put into the container. do not confuse with
2022-08-11 19:34:25 +00:00
-- popup - containers are designed to separate contents within a popup.
2022-07-23 19:10:02 +00:00
return function ( layout , options )
return awmtk.merge ( {
{
layout ,
2022-08-21 12:28:28 +00:00
margins = style.container . margins ,
layout = wibox.container . margin
2022-07-23 19:10:02 +00:00
} ,
2022-09-07 17:43:25 +00:00
bgimage = style.container . bgimage_normal ,
2022-07-23 19:10:02 +00:00
bg = style.container . bg_normal ,
2022-09-07 17:43:25 +00:00
fg = style.container . fg_normal ,
2022-07-23 19:10:02 +00:00
shape = style.container . shape ,
2022-09-08 10:56:04 +00:00
shape_border_color = style.container . shape_border_color ,
shape_border_width = style.container . shape_border_width ,
2022-10-24 11:19:57 +00:00
widget = awmtk.wrap_hooks ( wibox.container . background , options )
2022-07-23 19:10:02 +00:00
} , options or { } )
end
end ,
2023-01-16 12:47:51 +00:00
2022-07-23 19:10:02 +00:00
button = function ( style )
2022-10-24 11:19:57 +00:00
-- self explanatory. notice that this does not bear any function -
-- only the visual part of the button. by design, onpress and onrelease
2022-08-11 19:34:25 +00:00
-- callbacks should be connected to button events for animations
2022-07-23 19:10:02 +00:00
return function ( layout , options )
return awmtk.merge ( {
{
layout ,
2022-08-21 12:28:28 +00:00
margins = style.button . margins ,
layout = wibox.container . margin
2022-07-23 19:10:02 +00:00
} ,
2022-09-07 17:43:25 +00:00
bgimage = style.button . bgimage_normal ,
2022-07-23 19:10:02 +00:00
bg = style.button . bg_normal ,
2022-09-07 17:43:25 +00:00
fg = style.button . fg_normal ,
2022-07-23 19:10:02 +00:00
shape = style.button . shape ,
2022-09-08 10:56:04 +00:00
shape_border_color = style.button . shape_border_color ,
shape_border_width = style.button . shape_border_width ,
2022-12-10 22:28:22 +00:00
widget = awmtk.wrap_hooks ( wibox.container . background , options )
2022-07-23 19:10:02 +00:00
} , options or { } )
end
end ,
textbox = function ( style )
2022-10-24 11:19:57 +00:00
-- nothing fancy here, but you can set per-widget fonts using beautiful.
2022-07-23 19:10:02 +00:00
return function ( options )
return awmtk.merge ( {
font = style.textbox . font ,
2022-12-10 22:28:22 +00:00
widget = awmtk.wrap_hooks ( wibox.widget . textbox , options )
2022-07-23 19:10:02 +00:00
} , options or { } )
end
end ,
hseparator = function ( style )
2022-10-24 11:19:57 +00:00
-- wow, i guess?
2022-07-23 19:10:02 +00:00
return function ( options )
2022-08-11 19:34:25 +00:00
return awmtk.merge ( {
2022-12-10 22:28:22 +00:00
widget = awmtk.wrap_hooks ( wibox.widget . separator , options ) ,
2022-07-23 19:10:02 +00:00
orientation = " horizontal " ,
thickness = style.separator . thickness ,
color = style.separator . color ,
border_width = style.separator . border_width
} , options or { } )
end
end ,
2022-12-10 22:28:22 +00:00
2023-01-19 13:42:20 +00:00
icon = function ( style )
return function ( args )
args = args or { }
return {
{
{
{
image = args.image ,
id = args.id ,
resize = args.resize ,
widget = wibox.widget . imagebox
} ,
widget = wibox.container . margin ,
margins = args.margins or style.icon . margins
} ,
strategy = args.constraint or style.icon . constraint ,
height = args.height or
style.icon . height ,
width = args.width or
style.icon . width ,
widget = awmtk.wrap_hooks ( wibox.container . constraint ,
args ) ,
id = " constraint "
} ,
--widget = awmtk.wrap_hooks(
widget = wibox.container . place ,
-- args
--),
valign = args.valign or style.icon . valign ,
halign = style.icon . halign or style.icon . halign
}
end
end ,
2022-07-23 19:10:02 +00:00
vseparator = function ( style )
2022-10-24 11:19:57 +00:00
-- i'm running out of comments
2022-07-23 19:10:02 +00:00
return function ( options )
2022-08-11 19:34:25 +00:00
return awmtk.merge ( {
2022-12-10 22:28:22 +00:00
widget = awmtk.wrap_hooks ( wibox.widget . separator , options ) ,
2022-07-23 19:10:02 +00:00
orientation = " vertical " ,
thickness = style.separator . thickness ,
color = style.separator . color ,
border_width = style.separator . border_width
} , options or { } )
end
end ,
article = function ( style )
2022-10-24 11:19:57 +00:00
-- article is a template that combines 3 common pieces of a full item:
-- icon, name and description. designed to be placed within a container
2022-08-23 13:03:15 +00:00
-- or a button.
2022-07-23 19:10:02 +00:00
return function ( options )
return awmtk.merge ( {
( options.icon and {
{
{
image = options.icon ,
2022-08-21 12:28:28 +00:00
id = options.icon_id ,
2022-07-23 19:10:02 +00:00
resize = options.resize ,
widget = wibox.widget . imagebox
} ,
strategy = " exact " ,
height = options.icon_size or
style.article . icon_size ,
2022-12-10 22:28:22 +00:00
width = options.icon_size or
2022-07-23 19:10:02 +00:00
style.article . icon_size ,
2022-12-10 22:28:22 +00:00
widget = wibox.container . constraint
2022-07-23 19:10:02 +00:00
} ,
widget = wibox.container . place ,
valign = " center " ,
halign = " center "
} ) ,
{
{
markup = options.title or " " ,
2022-08-21 12:28:28 +00:00
id = options.title_id ,
2022-07-23 19:10:02 +00:00
widget = wibox.widget . textbox ,
2022-08-21 12:28:28 +00:00
font = style.article . font ,
2022-08-30 07:00:35 +00:00
valign = style.article . title_valign or " center " ,
align = style.article . title_align or " left "
2022-07-23 19:10:02 +00:00
} ,
( options.description and {
2022-08-21 12:28:28 +00:00
markup = options.description or " " ,
id = options.desc_id ,
2022-07-23 19:10:02 +00:00
widget = wibox.widget . textbox ,
2022-08-21 12:28:28 +00:00
font = style.article . small_font ,
2022-08-30 07:00:35 +00:00
valign = style.article . desc_valign or " center " ,
align = style.article . desc_align or " left "
2022-07-23 19:10:02 +00:00
} ) ,
spacing = style.article . spacing ,
layout = wibox.layout . flex.vertical
} ,
spacing = style.article . spacing ,
2022-12-10 22:28:22 +00:00
layout = awmtk.wrap_hooks (
wibox.layout . fixed.horizontal ,
options
)
2022-07-23 19:10:02 +00:00
} , options or { } )
end
end ,
2022-08-30 07:00:35 +00:00
center = function ( style )
return function ( layout , options )
options = options or { }
return awmtk.merge ( {
{
layout ,
strategy = " exact " ,
height = options.height or
style.center . height ,
2022-12-10 22:28:22 +00:00
width = options.width or
2022-08-30 07:00:35 +00:00
style.center . width ,
2022-12-10 22:28:22 +00:00
widget = wibox.container . constraint
2022-08-30 07:00:35 +00:00
} ,
2022-12-10 22:28:22 +00:00
widget = awmtk.wrap_hooks (
wibox.container . place ,
options
) ,
2022-08-30 07:00:35 +00:00
valign = " center " ,
halign = " center "
} , options or { } )
end
end ,
2022-07-23 19:10:02 +00:00
popup = function ( style )
2022-10-24 11:19:57 +00:00
-- popup is a distinct template designed to accomodate the "root" of
2022-08-11 19:34:25 +00:00
-- a popup, allowing one to add titlebars to popups, for example.
2022-07-23 19:10:02 +00:00
return function ( widget , options )
return awmtk.merge ( {
widget = {
2022-08-11 19:34:25 +00:00
widget ,
2022-08-21 12:28:28 +00:00
margins = style.popup . margins ,
2022-12-10 22:28:22 +00:00
layout = awmtk.wrap_hooks ( wibox.container . margin , options )
2022-07-23 19:10:02 +00:00
} ,
2022-09-07 17:43:25 +00:00
bgimage = style.popup . bgimage_normal ,
2022-07-23 19:10:02 +00:00
shape = style.popup . shape ,
visible = false ,
ontop = true
} , options or { } )
end
2022-08-11 19:34:25 +00:00
end ,
titlebar = function ( style )
2022-10-24 11:19:57 +00:00
-- titlebar is a separate class specifically for window and popup
-- titlebars. the decision to make it a separate class was due to
2022-08-11 19:34:25 +00:00
-- the fact that much customization is done through default theme table
return function ( layout , options )
2022-10-24 11:19:57 +00:00
-- if there's one thing that fascinates me, it's how much weird
2022-08-21 12:28:28 +00:00
-- bugs i manage to uncover by some sort of miraculous accident.
2022-10-24 11:19:57 +00:00
-- this one fixes a race condition in margins+(left/right/bottom/top) configuration scenario
2022-08-21 12:28:28 +00:00
local margins = style.titlebar . margins
2022-12-10 22:28:22 +00:00
if ( style.titlebar . left or
style.titlebar . right or
style.titlebar . bottom or
2022-08-21 12:28:28 +00:00
style.titlebar . top ) then
margins = nil
end
2022-08-11 19:34:25 +00:00
return awmtk.merge ( {
layout ,
2022-08-21 12:28:28 +00:00
margins = margins ,
2022-12-10 22:28:22 +00:00
layout = awmtk.wrap_hooks ( wibox.container . margin , options ) ,
2022-08-11 19:34:25 +00:00
left = style.titlebar . left ,
right = style.titlebar . right ,
bottom = style.titlebar . bottom ,
top = style.titlebar . top
} , options or { } )
end
2022-08-21 12:28:28 +00:00
end ,
wibar = function ( style )
2023-08-16 19:40:39 +00:00
-- just your regular old wibar, but as a style template.
2022-08-21 12:28:28 +00:00
return function ( layout , options )
local margins = style.wibar . margins
2022-12-10 22:28:22 +00:00
if ( style.wibar . left or
style.wibar . right or
style.wibar . bottom or
2022-08-21 12:28:28 +00:00
style.wibar . top ) then
margins = nil
end
return awmtk.merge ( {
layout ,
margins = margins ,
2022-12-10 22:28:22 +00:00
layout = awmtk.wrap_hooks ( wibox.container . margin , options ) ,
2022-08-21 12:28:28 +00:00
left = style.wibar . left ,
right = style.wibar . right ,
bottom = style.wibar . bottom ,
top = style.wibar . top
} , options or { } )
end
2022-08-30 07:00:35 +00:00
end ,
2023-01-19 13:42:20 +00:00
slider = function ( style , vertical )
2022-10-24 11:19:57 +00:00
-- slider widget but wired to work with the awmtk2 namespace system
2022-08-30 07:00:35 +00:00
return function ( args )
2023-01-19 13:42:20 +00:00
if not vertical then
return awmtk.merge ( {
handle_shape = style.slider . handle_shape or style.slider . shape ,
handle_color = style.slider . bg_normal ,
handle_margins = style.slider . handle_margins ,
handle_width = style.slider . handle_width ,
handle_border_color = style.slider . handle_border_color ,
handle_border_width = style.slider . handle_border_width ,
bar_shape = style.slider . bar_shape or style.slider . shape ,
bar_height = style.slider . bar_height ,
bar_color = style.slider . bg_focus ,
bar_margins = style.slider . bar_margins ,
bar_border_width = style.slider . bar_border_width ,
bar_border_color = style.slider . bar_border_color ,
forced_width = style.slider . width ,
forced_height = style.slider . height ,
widget = awmtk.wrap_hooks ( wibox.widget . slider , args )
} , args or { } )
else
return {
awmtk.merge ( {
handle_shape = style.slider . handle_shape or style.slider . shape ,
handle_color = style.slider . bg_normal ,
handle_margins = style.slider . handle_margins ,
handle_width = style.slider . handle_width ,
handle_border_color = style.slider . handle_border_color ,
handle_border_width = style.slider . handle_border_width ,
bar_shape = style.slider . bar_shape or style.slider . shape ,
bar_height = style.slider . bar_height ,
bar_color = style.slider . bg_focus ,
bar_margins = style.slider . bar_margins ,
bar_border_width = style.slider . bar_border_width ,
bar_border_color = style.slider . bar_border_color ,
forced_width = style.slider . width ,
forced_height = style.slider . height ,
widget = awmtk.wrap_hooks ( wibox.widget . slider , args )
} , args or { } ) ,
widget = wibox.container . rotate ,
direction = " west "
}
end
2022-08-30 07:00:35 +00:00
end
2022-09-16 18:42:50 +00:00
end ,
checkbox = function ( style )
return function ( args )
return awmtk.merge ( {
2022-12-10 22:28:22 +00:00
color = style.checkbox . color or style.checkbox . bg_normal ,
paddings = style.checkbox . paddings ,
2022-09-16 18:42:50 +00:00
shape = style.checkbox . shape ,
2022-12-10 22:28:22 +00:00
border_width = style.checkbox . border_width ,
border_color = style.checkbox . border_color or style.checkbox . bg_normal ,
bg = style.checkbox . bg or style.checkbox . bg_focus ,
check_color = style.checkbox . check_color or style.checkbox . bg_normal ,
check_shape = style.checkbox . check_shape ,
widget = awmtk.wrap_hooks ( wibox.widget . checkbox , args )
} , args )
2022-09-16 18:42:50 +00:00
end
2022-08-23 13:03:15 +00:00
end
2022-07-23 19:10:02 +00:00
}
2022-08-11 19:34:25 +00:00
2022-10-24 11:19:57 +00:00
-- last but not least - we export a default template lib and default style.
-- this is done in order to allow overriding default style behaviour from theme
2022-08-11 19:34:25 +00:00
awmtk.default = awmtk.create_style ( " default " , awmtk.proto_style , { } )
awmtk.templates = awmtk.create_template_lib ( " templates " , awmtk.proto_templates , { } )
2022-09-05 21:54:11 +00:00
2022-10-24 11:19:57 +00:00
-- generic styles for widgets that need them
2022-09-05 21:54:11 +00:00
awmtk.generic = { }
awmtk.generic . menu = awmtk.create_style ( " generic_menu " , awmtk.default , { } )
awmtk.generic . button_list = awmtk.create_style ( " generic_button_list " , awmtk.default , { } )
awmtk.generic . iconified_widget = awmtk.create_style ( " generic_iconified_widget " , awmtk.default , { } )
awmtk.generic . status_widget = awmtk.create_style ( " generic_status_widget " , awmtk.default , { } )
awmtk.generic . oneline_widget = awmtk.create_style ( " generic_oneline_widget " , awmtk.default , { } )
awmtk.generic . composite_widget = awmtk.create_style ( " generic_composite_widget " , awmtk.default , { } )
2022-09-06 22:40:51 +00:00
awmtk.generic . popup = awmtk.create_style ( " generic_popup " , awmtk.default , { } )
2022-07-23 19:10:02 +00:00
-- }}}
2022-07-12 21:26:11 +00:00
return awmtk