From bba4badb27a39726f32e437c04b63670e5fb2bcc Mon Sep 17 00:00:00 2001 From: Yessiest Date: Fri, 8 Apr 2022 14:08:50 +0400 Subject: [PATCH] Added the function for creating subcontexts --- libs/awmtk2.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libs/awmtk2.lua b/libs/awmtk2.lua index 93a0fc8..7576541 100644 --- a/libs/awmtk2.lua +++ b/libs/awmtk2.lua @@ -7,7 +7,19 @@ local awmtk = {} -- {{{ Utils - +awmtk.subclass = function(parent_class,instance_overrides,name) + return setmetatable(instance_overrides,{ + __index = function(self,k) + if rawget(self,k) then + return rawget(self,k) + elseif type(beautiful[name]) == "table" and beautiful[name][k] then + return beautiful[name][k] + elseif parent_class[k] then + return parent_class[k] + end + end + }) +end -- }}} @@ -17,7 +29,10 @@ local awmtk = {} -- Default namespace awmtk.default = setmetatable({}, { -- { Backgrounds - + -- custom background color for highlighting elements + bg_highlight = beautiful.bg_highlight or beautiful.bg_focus + -- } + -- { }, { __index = beautiful })