Added widget classification

This commit is contained in:
Yessiest 2022-09-07 02:40:51 +04:00
parent 92aed20ebb
commit 688c01afc1
14 changed files with 78 additions and 56 deletions

View File

@ -421,5 +421,6 @@ awmtk.generic.iconified_widget = awmtk.create_style("generic_iconified_widget",a
awmtk.generic.status_widget = awmtk.create_style("generic_status_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.oneline_widget = awmtk.create_style("generic_oneline_widget",awmtk.default,{})
awmtk.generic.composite_widget = awmtk.create_style("generic_composite_widget",awmtk.default,{}) awmtk.generic.composite_widget = awmtk.create_style("generic_composite_widget",awmtk.default,{})
awmtk.generic.popup = awmtk.create_style("generic_popup",awmtk.default,{})
-- }}} -- }}}
return awmtk return awmtk

View File

@ -48,7 +48,7 @@ end -- }}}
do --{{{ Screen do --{{{ Screen
local wibar_config = {} local wibar_config = {}
local style = awmtk2.create_style("wibar",awmtk2.default,{}) local style = awmtk2.create_style("wibar",awmtk2.generic.composite_widget,{})
for k,v in pairs({"wibar_top","wibar_bottom","wibar_left","wibar_right"}) do for k,v in pairs({"wibar_top","wibar_bottom","wibar_left","wibar_right"}) do
style[v] = awmtk2.create_delta(v, {}, style[v] = awmtk2.create_delta(v, {},
(beautiful.widgets and beautiful.widgets.wibar) or {}, (beautiful.widgets and beautiful.widgets.wibar) or {},
@ -94,7 +94,7 @@ end -- }}}
do -- {{{ Titlebars do -- {{{ Titlebars
local titlebar_config = {} local titlebar_config = {}
local style = awmtk2.create_style("titlebar",awmtk2.default,{}) local style = awmtk2.create_style("titlebar",awmtk2.generic.composite_widget,{})
for k,v in pairs({"titlebar_top","titlebar_left","titlebar_right","titlebar_bottom"}) do for k,v in pairs({"titlebar_top","titlebar_left","titlebar_right","titlebar_bottom"}) do
-- Create styles for each titlebar -- Create styles for each titlebar
style[v] = awmtk2.create_delta(v, {}, style[v] = awmtk2.create_delta(v, {},

View File

@ -13,7 +13,8 @@ local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
return function(args) return function(args)
local style = awmtk2.create_style("popuptitle",awmtk2.default,args.style) local style = awmtk2.create_style("popuptitle",
awmtk2.generic.oneline_widget,args.style)
local templates = awmtk2.create_template_lib("popuptitle",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("popuptitle",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(t.article({ local widget = wibox.widget(t.container(t.article({

View File

@ -13,7 +13,8 @@ local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
return function(args) return function(args)
local style = awmtk2.create_style("subpanel",awmtk2.default,args.style) local style = awmtk2.create_style("subpanel",
awmtk2.generic.composite_widget,args.style)
local templates = awmtk2.create_template_lib("subpanel",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("subpanel",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(args.layout)) local widget = wibox.widget(t.container(args.layout))

View File

@ -13,7 +13,8 @@ local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
return function(args) return function(args)
local style = awmtk2.create_style("taglist",awmtk2.default,args.style) local style = awmtk2.create_style("taglist",
awmtk2.generic.oneline_widget,args.style)
local templates = awmtk2.create_template_lib("taglist",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("taglist",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(awful.widget.taglist({ local widget = wibox.widget(t.container(awful.widget.taglist({

View File

@ -42,7 +42,7 @@ end
return function(args) return function(args)
local style = awmtk2.create_style("battery", local style = awmtk2.create_style("battery",
awmtk2.generic.status_widget,args.style) awmtk2.generic.popup,args.style)
local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
-- set up popup layout -- set up popup layout
@ -52,34 +52,39 @@ return function(args)
}) })
-- create popup -- create popup
local popup = awful.popup(t.popup(layout)) local popup = awful.popup(t.popup(layout))
-- create battery widget local battery_widget
local battery_widget = wibox.widget(t.button({ do -- create battery widget
{ local style = awmtk2.create_style("battery",
image = beautiful["battery-missing-symbolic"], awmtk2.generic.status_widget,args.style)
resize = true, local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates)
widget = wibox.widget.imagebox, local t = awmtk2.build_templates(templates,style)
id = "virtual_id" battery_widget = wibox.widget(t.button({
}, {
(args.percentage and { image = beautiful["battery-missing-symbolic"],
markup = "0%", resize = true,
id = "percentage_id", widget = wibox.widget.imagebox,
widget = wibox.widget.textbox id = "virtual_id"
}), },
layout = wibox.layout.fixed.horizontal, (args.percentage and {
spacing = style.base.spacing markup = "0%",
})) id = "percentage_id",
-- make it possible to press the button and make it toggle the popup widget = wibox.widget.textbox
battery_widget:connect_signal("button::press",style.button.onpress) }),
battery_widget:connect_signal("button::release",style.button.onrelease) layout = wibox.layout.fixed.horizontal,
battery_widget:connect_signal("button::press",function(self,x,y,button) spacing = style.base.spacing
if button == 1 then }))
popup.visible = (not popup.visible) -- make it possible to press the button and make it toggle the popup
if popup.visible then battery_widget:connect_signal("button::press",style.button.onpress)
popup:move_next_to(mouse.current_widget_geometry) battery_widget:connect_signal("button::release",style.button.onrelease)
battery_widget:connect_signal("button::press",function(self,x,y,button)
if button == 1 then
popup.visible = (not popup.visible)
if popup.visible then
popup:move_next_to(mouse.current_widget_geometry)
end
end end
end end)
end) end
-- map widgets to their names to make it easier to update separate components -- map widgets to their names to make it easier to update separate components
local widget_map = {} local widget_map = {}
-- also map current charge state of every device to get the icon for the tray -- also map current charge state of every device to get the icon for the tray

View File

@ -14,7 +14,7 @@ local beautiful = require("beautiful")
local menugen = require("context_menu") local menugen = require("context_menu")
local builder = require("builder") local builder = require("builder")
local style = awmtk2.create_style("client_menu", local style = awmtk2.create_style("client_menu",
awmtk2.generic.menu,{}) awmtk2.generic.composite_widget,{})
local templates = awmtk2.create_template_lib("client_menu",awmtk2.templates,{}) local templates = awmtk2.create_template_lib("client_menu",awmtk2.templates,{})
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)

View File

@ -27,7 +27,8 @@ local xdg_search = function(name,rlimit)
end end
return function(args) return function(args)
local style = awmtk2.create_style("dismal",awmtk2.default,args.style) local style = awmtk2.create_style("dismal",
awmtk2.generic.popup,args.style)
local templates = awmtk2.create_template_lib("dismal",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("dismal",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local launchpad = awful.popup(t.popup({ local launchpad = awful.popup(t.popup({

View File

@ -16,7 +16,8 @@ local DateTime = glib.DateTime
local TimeZone = glib.TimeZone local TimeZone = glib.TimeZone
return function(args) return function(args)
local style = awmtk2.create_style("lock_clock",awmtk2.default,args.style) local style = awmtk2.create_style("lock_clock",
awmtk2.generic.status_widget,args.style)
local templates = awmtk2.create_template_lib("lock_clock",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("lock_clock",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
-- Don't mind me just stealing default library code -- Don't mind me just stealing default library code

View File

@ -31,7 +31,8 @@ local function _preload(args)
do -- {{{ Lock bar do -- {{{ Lock bar
local config_path = root_path.."/themes/"..global.theme.."/config/lockbar.json" local config_path = root_path.."/themes/"..global.theme.."/config/lockbar.json"
if readable(config_path) then if readable(config_path) then
local style = awmtk2.create_style("lockbar", awmtk2.default, args.style) local style = awmtk2.create_style("lockbar",
awmtk2.generic.composite_widget, args.style)
local templates = awmtk2.create_template_lib("lockbar",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("lockbar",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local config_file = io.open(config_path,"r") local config_file = io.open(config_path,"r")
@ -50,7 +51,8 @@ local function _preload(args)
end end
end -- }}} end -- }}}
do -- {{{ Lock widget do -- {{{ Lock widget
local style = awmtk2.create_style("lockpanel", awmtk2.default, args.style) local style = awmtk2.create_style("lockpanel",
awmtk2.generic.composite_widget, args.style)
local templates = awmtk2.create_template_lib("lockpanel",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("lockpanel",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local config_path = root_path.."/themes/"..global.theme.."/config/lockpanel.json" local config_path = root_path.."/themes/"..global.theme.."/config/lockpanel.json"

View File

@ -16,7 +16,7 @@ local naughty = require("naughty")
return function(args) return function(args)
local style = awmtk2.create_style("notifications", local style = awmtk2.create_style("notifications",
awmtk2.generic.iconified_widget,args.style) awmtk2.generic.popup,args.style)
local templates = awmtk2.create_template_lib("notifications",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("notifications",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local layout = wibox.widget({ local layout = wibox.widget({
@ -82,20 +82,27 @@ return function(args)
return update_args return update_args
end end
-- create popup button -- create popup button
local clip_widget = wibox.widget(t.button({ local clip_widget
image = beautiful["notifications-area-symbolic"], do
resize = true, local style = awmtk2.create_style("notifications",
widget = wibox.widget.imagebox, awmtk2.generic.iconified_widget,args.style)
})) local templates = awmtk2.create_template_lib("notifications",awmtk2.templates,args.templates)
clip_widget:connect_signal("button::press",style.button.onpress) local t = awmtk2.build_templates(templates,style)
clip_widget:connect_signal("button::release",style.button.onrelease) clip_widget = wibox.widget(t.button({
clip_widget:connect_signal("button::press",function(self,x,y,button) image = beautiful["notifications-area-symbolic"],
if button == 1 then resize = true,
popup.visible = (not popup.visible) widget = wibox.widget.imagebox,
if popup.visible then }))
popup:move_next_to(mouse.current_widget_geometry) clip_widget:connect_signal("button::press",style.button.onpress)
clip_widget:connect_signal("button::release",style.button.onrelease)
clip_widget:connect_signal("button::press",function(self,x,y,button)
if button == 1 then
popup.visible = (not popup.visible)
if popup.visible then
popup:move_next_to(mouse.current_widget_geometry)
end
end end
end end)
end) end
return clip_widget return clip_widget
end end

View File

@ -15,7 +15,7 @@ local builder = require("builder")
return function(args) return function(args)
local style = awmtk2.create_style("root_menu", local style = awmtk2.create_style("root_menu",
awmtk2.generic.menu,{}) awmtk2.generic.composite_widget,{})
local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,{}) local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,{})
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local config_file = io.open(root_path.."/themes/"..global.theme.."/config/root_menu.json","r") local config_file = io.open(root_path.."/themes/"..global.theme.."/config/root_menu.json","r")

View File

@ -14,7 +14,8 @@ local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
return function(args) return function(args)
local style = awmtk2.create_style("soundclown",awmtk2.default,args.style) local style = awmtk2.create_style("soundclown",
awmtk2.generic.oneline_widget,args.style)
local templates = awmtk2.create_template_lib("soundclown",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("soundclown",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local test = os.execute("mpc help") local test = os.execute("mpc help")

View File

@ -31,7 +31,8 @@ local tasklist_buttons = gears.table.join(
) )
return function(args) return function(args)
local style = awmtk2.create_style("tasklist", awmtk2.default, args.style) local style = awmtk2.create_style("tasklist",
awmtk2.generic.oneline_widget, args.style)
local templates = awmtk2.create_template_lib("tasklist", awmtk2.templates, args.templates) local templates = awmtk2.create_template_lib("tasklist", awmtk2.templates, args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local button = t.button({ local button = t.button({