Compare commits

...

3 Commits

Author SHA1 Message Date
Yessiest 44a1c20d61 Made dismal temporarily usable 2022-04-20 00:20:21 +04:00
Yessiest 86bbe93ef4 Added test widget for awmtk2 2022-04-19 17:22:45 +04:00
Yessiest 000334fb96 test 2022-04-19 17:19:53 +04:00
3 changed files with 99 additions and 45 deletions

View File

@ -54,6 +54,7 @@ awful.screen.connect_for_each_screen(function(s)
}) })
-- Add screen lock -- Add screen lock
require("widgets.lock")({screen = s, obscure = true}) require("widgets.lock")({screen = s, obscure = true})
require("widgets.dismal")({})
require("widgets.unitybar")(s,{ require("widgets.unitybar")(s,{
top_widgets = { top_widgets = {
require("widgets.polytasklist")({ require("widgets.polytasklist")({

View File

@ -6,14 +6,18 @@ local beautiful = require("beautiful")
local awmtk = {} local awmtk = {}
-- {{{ Utils -- {{{ Utils
local debugdata = io.open("/home/yessiest/.awesome_errors","w")
awmtk.create_namespace = function(parent_class,instance_overrides,name) awmtk.create_class = function(name,overrides,style,parent_class)
return setmetatable(instance_overrides,{ return setmetatable(overrides,{
__index = function(self,k) __index = function(self,k)
debugdata:write(tostring(name)..": "..tostring(k).."\n")
-- Per-widget overrides are top priority
if rawget(self,k) then if rawget(self,k) then
return rawget(self,k) return rawget(self,k)
elseif type(beautiful[name]) == "table" and beautiful[name][k] then -- Style overrides are second in priority
return beautiful[name][k] elseif type(style[name]) == "table" and rawget(style[name],k) then
return rawget(style[name],k)
-- Parent class is fallback
elseif parent_class[k] then elseif parent_class[k] then
return parent_class[k] return parent_class[k]
end end
@ -21,50 +25,65 @@ awmtk.create_namespace = function(parent_class,instance_overrides,name)
}) })
end end
awmtk.create_class = function awmtk.create_style = function(name,parent,overrides)
local new_style = setmetatable(beautiful[name] or {},{
__index = function(self,k)
if rawget(self,k) then
return rawget(self,k)
else
return parent[k]
end
end
})
for name,parent_class in pairs(parent) do
new_style[name] = awmtk.create_class(
name,
(overrides and overrides[name]) or {},
new_style,
parent_class
)
end
return new_style
end
-- }}} -- }}}
-- {{{ Classes and namespaces -- {{{ Default style
-- Default namespace -- Default style
awmtk.default = setmetatable({ awmtk.default = {
-- { Backgrounds base = setmetatable({},{
-- custom background color for highlighting elements -- { Backgrounds
bg_highlight = beautiful.bg_highlight or beautiful.bg_focus, -- custom background color for highlighting elements
-- } bg_highlight = beautiful.bg_highlight or beautiful.bg_focus,
-- { Borders -- }
-- Borders for popups -- { Borders
shape_border_width = beautiful.shape_border_width or 0, -- Borders for popups
shape_border_color = beautiful.shape_border_color or beautiful.bg_normal, shape_border_width = beautiful.shape_border_width or 0,
-- } shape_border_color = beautiful.shape_border_color or beautiful.bg_normal,
-- { Shapes -- }
inner_margin = beautiful.inner_margin or 5 -- { Shapes
rounding = beautiful.rounding or 0 inner_margin = beautiful.inner_margin or 5,
-- } rounding = beautiful.rounding or 0,
}, { __index = beautiful }) -- }
},{__index = beautiful})
-- Container subnamespace }
-- We copy the table instead of referncing default namespace to avoid recursion
awmtk.default.container = setmetatable({
-- { Backgrounds
-- custom background color for highlighting elements
bg_highlight = beautiful.bg_highlight or beautiful.bg_focus,
-- }
-- { Borders
-- Borders for popups
shape_border_width = beautiful.shape_border_width or 0,
shape_border_color = beautiful.shape_border_color or beautiful.bg_normal,
-- }
-- { Shapes
inner_margin = beautiful.inner_margin or 5
rounding = beautiful.rounding or 0
-- }
-- { Layout spacing
spacing = (beautiful.container and beautiful.container.spacing) or 2
},{
__index = beautiful
})
-- Container subclass
awmtk.default.container = awmtk.create_class("container",{
},awmtk.default,awmtk.default.base)
-- Button subclass
awmtk.default.button = awmtk.create_class("button",{
inner_margin = 1
},awmtk.default,awmtk.default.base)
-- Icon subclass
awmtk.default.icon = awmtk.create_class("icon",{
inner_margin = 1
},awmtk.default,awmtk.default.base)
return awmtk
-- }}}

34
widgets/dismal.lua Normal file
View File

@ -0,0 +1,34 @@
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
return function(args)
local style = awmtk2.create_style("dismal",awmtk2.default,args.style)
local launchpad = awful.popup({
widget = {
{
{
{
markup = "[b]Enter[/b] - run; [b]Ctrl+Enter[/b] - run in terminal",
widget = wibox.widget.textbox
},
layout = wibox.layout.fixed.vertical
},
widget = wibox.container.margin,
margin = style.container.inner_margin
},
bg = style.container.bg_normal,
widget = wibox.container.background
},
visible = false,
ontop = true
})
root.keys(gears.table.join(
root.keys(),
awful.key({ global.modkey }, "0", function()
launchpad.visible = not launchpad.visible
end)
))
return launchpad
end