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.oneline_widget = awmtk.create_style("generic_oneline_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

View File

@ -48,7 +48,7 @@ end -- }}}
do --{{{ Screen
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
style[v] = awmtk2.create_delta(v, {},
(beautiful.widgets and beautiful.widgets.wibar) or {},
@ -94,7 +94,7 @@ end -- }}}
do -- {{{ Titlebars
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
-- Create styles for each titlebar
style[v] = awmtk2.create_delta(v, {},

View File

@ -13,7 +13,8 @@ local awful = require("awful")
local beautiful = require("beautiful")
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 t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(t.article({

View File

@ -13,7 +13,8 @@ local awful = require("awful")
local beautiful = require("beautiful")
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 t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(args.layout))

View File

@ -13,7 +13,8 @@ local awful = require("awful")
local beautiful = require("beautiful")
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 t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(awful.widget.taglist({

View File

@ -42,7 +42,7 @@ end
return function(args)
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 t = awmtk2.build_templates(templates,style)
-- set up popup layout
@ -52,34 +52,39 @@ return function(args)
})
-- create popup
local popup = awful.popup(t.popup(layout))
-- create battery widget
local battery_widget = wibox.widget(t.button({
{
image = beautiful["battery-missing-symbolic"],
resize = true,
widget = wibox.widget.imagebox,
id = "virtual_id"
},
(args.percentage and {
markup = "0%",
id = "percentage_id",
widget = wibox.widget.textbox
}),
layout = wibox.layout.fixed.horizontal,
spacing = style.base.spacing
}))
-- make it possible to press the button and make it toggle the popup
battery_widget:connect_signal("button::press",style.button.onpress)
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)
local battery_widget
do -- create battery widget
local style = awmtk2.create_style("battery",
awmtk2.generic.status_widget,args.style)
local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
battery_widget = wibox.widget(t.button({
{
image = beautiful["battery-missing-symbolic"],
resize = true,
widget = wibox.widget.imagebox,
id = "virtual_id"
},
(args.percentage and {
markup = "0%",
id = "percentage_id",
widget = wibox.widget.textbox
}),
layout = wibox.layout.fixed.horizontal,
spacing = style.base.spacing
}))
-- make it possible to press the button and make it toggle the popup
battery_widget:connect_signal("button::press",style.button.onpress)
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
-- map widgets to their names to make it easier to update separate components
local widget_map = {}
-- 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 builder = require("builder")
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 t = awmtk2.build_templates(templates,style)

View File

@ -27,7 +27,8 @@ local xdg_search = function(name,rlimit)
end
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 t = awmtk2.build_templates(templates,style)
local launchpad = awful.popup(t.popup({

View File

@ -16,7 +16,8 @@ local DateTime = glib.DateTime
local TimeZone = glib.TimeZone
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 t = awmtk2.build_templates(templates,style)
-- Don't mind me just stealing default library code

View File

@ -31,7 +31,8 @@ local function _preload(args)
do -- {{{ Lock bar
local config_path = root_path.."/themes/"..global.theme.."/config/lockbar.json"
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 t = awmtk2.build_templates(templates,style)
local config_file = io.open(config_path,"r")
@ -50,7 +51,8 @@ local function _preload(args)
end
end -- }}}
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 t = awmtk2.build_templates(templates,style)
local config_path = root_path.."/themes/"..global.theme.."/config/lockpanel.json"

View File

@ -16,7 +16,7 @@ local naughty = require("naughty")
return function(args)
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 t = awmtk2.build_templates(templates,style)
local layout = wibox.widget({
@ -82,20 +82,27 @@ return function(args)
return update_args
end
-- create popup button
local clip_widget = wibox.widget(t.button({
image = beautiful["notifications-area-symbolic"],
resize = true,
widget = wibox.widget.imagebox,
}))
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)
local clip_widget
do
local style = awmtk2.create_style("notifications",
awmtk2.generic.iconified_widget,args.style)
local templates = awmtk2.create_template_lib("notifications",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
clip_widget = wibox.widget(t.button({
image = beautiful["notifications-area-symbolic"],
resize = true,
widget = wibox.widget.imagebox,
}))
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
return clip_widget
end

View File

@ -15,7 +15,7 @@ local builder = require("builder")
return function(args)
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 t = awmtk2.build_templates(templates,style)
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")
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 t = awmtk2.build_templates(templates,style)
local test = os.execute("mpc help")

View File

@ -31,7 +31,8 @@ local tasklist_buttons = gears.table.join(
)
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 t = awmtk2.build_templates(templates,style)
local button = t.button({