Menu work

This commit is contained in:
Yessiest 2022-08-25 19:27:31 +04:00
parent 7bac292408
commit a423d30cde
27 changed files with 706 additions and 152 deletions

View File

@ -48,7 +48,7 @@ return function(description,opts)
return require(struct.widget)(gears.table.join({
layout = (struct.layout and inner_builder(struct.layout)), client = (struct.client and c),
screen = (struct.screen and s)
},struct.options or {}))
},struct.options or {},opts.passthrough or {}))
elseif struct.list then -- List descriptions
local list = {
layout = wibox.layout.fixed[(

View File

@ -11,7 +11,7 @@ local function position_popup(popup,widget,style)
popup:move_next_to(mouse.current_wibox)
-- Figure out the geometry of the base widget
local widget_geo
for k,v in pairs(mouse.current_widgets) do
for k,v in pairs(mouse.current_widgets or {}) do
if widget == v then
widget_geo = mouse.current_widget_geometries[k]
end
@ -30,6 +30,8 @@ local function position_popup(popup,widget,style)
end
return function(args)
-- A way to communicate that all widgets in menu got closed
args.on_close = args.on_close or function() end
local style = awmtk2.create_style("menu", awmtk2.default, args.style)
local templates = awmtk2.create_template_lib("menu", awmtk2.templates, args.templates)
local t = awmtk2.build_templates(templates,style)
@ -42,26 +44,22 @@ return function(args)
forced_width = style.button.forced_width,
forced_height = style.button.forced_height
}))
local onpress = function(widget)
style.button.onrelease(widget)
if root_layer.focused then
root_layer.focused:emit_signal("cascade::kill")
end
end
if type(element[2]) == "string" then
new_element:connect_signal("button::press",style.button.onpress)
new_element:connect_signal("button::press",function(widget)
awful.spawn(element[2])
end)
new_element:connect_signal("button::release",function(widget)
style.button.onrelease(widget)
if root_layer.focused then
root_layer.focused:emit_signal("cascade_close")
end
end)
new_element:connect_signal("button::release",onpress)
elseif type(element[2]) == "function" then
new_element:connect_signal("button::press",style.button.onpress)
new_element:connect_signal("button::press",element[2])
new_element:connect_signal("button::release",function(widget)
style.button.onrelease(widget)
if root_layer.focused then
root_layer.focused:emit_signal("cascade_close")
end
end)
new_element:connect_signal("button::release",onpress)
elseif type(element[2]) == "table" then
local layout = {
spacing = style.base.spacing,
@ -82,18 +80,20 @@ return function(args)
return
end
if layer.focused then
layer.focused:emit_signal("cascade_close")
layer.focused:emit_signal("cascade::close")
end
layer.focused = widget
position_popup(next_layer, new_element, style)
end
new_element:connect_signal("cascade_close",function()
local onclose = function()
style.button.onrelease(new_element)
if layout.focused then
layout.focused:emit_signal("cascade_close")
layout.focused:emit_signal("cascade::close")
end
next_layer.visible = false
end)
end
new_element:connect_signal("cascade::close",onclose)
new_element:connect_signal("cascade::kill",onclose)
-- that sweet "just move the mouse 4head" navigation
if style.base.menu_slide then
new_element:connect_signal("mouse::enter",open_layer)

View File

@ -1,7 +1,6 @@
local naughty = require("naughty")
local debug = {}
-- Thanks, u/skhil
-- (https://www.reddit.com/r/awesomewm/comments/te49nb/why_does_awesomes_ram_consumption_get_higher_and/)
-- from (https://www.reddit.com/r/awesomewm/comments/te49nb/why_does_awesomes_ram_consumption_get_higher_and/)
function debug.print_awesome_memory_stats(message)
print(os.date(), "\nLua memory usage:", collectgarbage("count"))
out_string = tostring(os.date()) .. "\nLua memory usage:"..tostring(collectgarbage("count")).."\n"

View File

@ -6,6 +6,7 @@ local beautiful = require("beautiful")
local builder = require("builder")
local mbarutils = require("menubar").utils
local menugen = require("context_menu")
local json = require("dkjson")
local function read_file(fname)
local fhandler = io.open(fname,"r")
@ -16,53 +17,6 @@ local function read_file(fname)
end
end
do -- {{{ Root menu
local style = awmtk2.create_style("root_menu",awmtk2.default,{})
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")
local config
if config_file then
config = config_file:read("*a")
config_file:close()
else
config = [[{"list": [
{"widget": "widgets.rootmenu"}
],
"vertical": true
}]]
end
local root_menu = awful.popup(t.popup(builder(
config,
{
style = style,
screen = mouse.screen,
}
)))
local buttons = root.buttons()
root.buttons(gears.table.join(buttons,
awful.button({}, 3, function()
if root_menu.visible then
local roots = root_menu.widget:get_children_by_id("menu_root")
for k,v in pairs(roots) do
for _,w in ipairs(v.children) do
if type(w) == "table" and w.emit_signal then
w:emit_signal("cascade_close")
end
end
end
end
root_menu.visible = (not root_menu.visible)
if root_menu.visible then
root_menu:move_next_to(gears.table.join(mouse.coords(),{
width = 0,
height = 0
}))
end
end)
))
end -- }}}
-- {{{ Placeholder Icons
client.connect_signal("request::titlebars",function(c)
if (not c.icon) and beautiful.icon_default then
@ -71,12 +25,20 @@ client.connect_signal("request::titlebars",function(c)
end)
-- }}}
-- {{{ Global widgets
local runmenu = require("widgets.dismal")({
x = 0,
y = 26
})
-- }}}
do -- {{{ Global widgets
local config_file = io.open(root_path.."/themes/"..global.theme.."/config/global.json","r")
local config
if config_file then
config = config_file:read("*a")
config_file:close()
else
config = "[]"
end
for k,v in pairs(json.decode(config) or {}) do
require(k)(v)
end
end -- }}}
do -- {{{ Titlebars
local titlebar_config = {}

View File

@ -82,8 +82,8 @@ for k,v in pairs(desktop_dirs) do
end,
output_done = function()
-- Call a global signal
awesome.emit_signal("xdg::dir_finished",v)
desktop_dirs_complete = desktop_dirs_complete + 1
awesome.emit_signal("xdg::dir_finished",v)
end
})
end

View File

@ -0,0 +1,7 @@
{
"list": [
{"widget": "widgets.clientcontrols"},
{"widget": "widgets.clientbuttons"}
],
"vertical":true
}

View File

@ -0,0 +1,7 @@
{
"widgets.dismal":{
"x":0,
"y":26
},
"widgets.rootmenu":{}
}

View File

@ -0,0 +1,22 @@
{
"list": [
{"widget": "widgets.base.popuptitle",
"options":{
"icon":"icons/reno98.png",
"title":"Reno 98"
}
},
{"widget": "widgets.base.tagswitcher",
"screen":true
},
{"widget": "widgets.rootcontrols"},
{"widget": "widgets.xdgmenu",
"options": {
"exclude_category": [
"Other"
]
}
}
],
"vertical": true
}

View File

@ -1,9 +1,9 @@
{
"align": {
"left": [
{
"builtin": "iconwidget",
"client": true
{
"widget":"widgets.clientmenu",
"client":true
}
],
"center": [

View File

@ -10,6 +10,7 @@
{ "widget": "widgets.base.subpanel",
"layout": {
"list": [
{ "widget": "widgets.base.systray" },
{ "widget": "widgets.base.clock" }
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 999 B

After

Width:  |  Height:  |  Size: 768 B

View File

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg3748"
width="960px"
version="1.1"
height="800px">
<metadata
id="metadata3752">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs2" />
<path
style="fill:#0000ff"
d="M 140 60 L 140 80 L 140 100 L 140 120 L 160 120 L 180 120 L 200 120 L 220 120 L 240 120 L 260 120 L 280 120 L 300 120 L 320 120 L 340 120 L 360 120 L 380 120 L 400 120 L 420 120 L 440 120 L 460 120 L 480 120 L 500 120 L 520 120 L 540 120 L 560 120 L 580 120 L 600 120 L 620 120 L 640 120 L 660 120 L 680 120 L 700 120 L 720 120 L 720 100 L 720 80 L 720 60 L 700 60 L 680 60 L 660 60 L 640 60 L 620 60 L 600 60 L 580 60 L 560 60 L 560 80 L 560 100 L 540 100 L 520 100 L 520 80 L 520 60 L 500 60 L 500 80 L 500 100 L 480 100 L 460 100 L 460 80 L 460 60 L 440 60 L 440 80 L 440 100 L 420 100 L 400 100 L 400 80 L 400 60 L 380 60 L 380 80 L 380 100 L 360 100 L 340 100 L 340 80 L 340 60 L 320 60 L 300 60 L 280 60 L 260 60 L 240 60 L 220 60 L 200 60 L 180 60 L 160 60 L 140 60 z "
id="rect554" />
<path
style="fill:#ffffff"
d="M 340 60 L 340 80 L 340 100 L 360 100 L 380 100 L 380 80 L 380 60 L 360 60 L 340 60 z M 400 60 L 400 80 L 400 100 L 420 100 L 440 100 L 440 80 L 440 60 L 420 60 L 400 60 z M 460 60 L 460 80 L 460 100 L 480 100 L 500 100 L 500 80 L 500 60 L 480 60 L 460 60 z M 520 60 L 520 80 L 520 100 L 540 100 L 560 100 L 560 80 L 560 60 L 540 60 L 520 60 z M 180 260 L 180 280 L 200 280 L 220 280 L 240 280 L 260 280 L 260 260 L 240 260 L 220 260 L 200 260 L 180 260 z M 260 280 L 260 300 L 280 300 L 280 280 L 260 280 z M 180 280 L 160 280 L 160 300 L 160 320 L 160 340 L 160 360 L 160 380 L 160 400 L 180 400 L 180 380 L 180 360 L 180 340 L 180 320 L 180 300 L 180 280 z M 180 400 L 180 420 L 200 420 L 220 420 L 240 420 L 260 420 L 260 400 L 240 400 L 220 400 L 200 400 L 180 400 z M 260 400 L 280 400 L 280 380 L 260 380 L 260 400 z M 380 260 L 380 280 L 380 300 L 400 300 L 400 280 L 400 260 L 380 260 z M 400 300 L 400 320 L 400 340 L 420 340 L 420 320 L 420 300 L 400 300 z M 420 340 L 420 360 L 420 380 L 440 380 L 440 360 L 440 340 L 420 340 z M 440 380 L 440 400 L 440 420 L 460 420 L 460 400 L 460 380 L 440 380 z M 340 300 L 340 320 L 360 320 L 360 300 L 340 300 z M 340 400 L 340 420 L 360 420 L 360 400 L 340 400 z M 480 400 L 480 420 L 500 420 L 520 420 L 540 420 L 560 420 L 580 420 L 600 420 L 620 420 L 640 420 L 660 420 L 680 420 L 680 400 L 660 400 L 640 400 L 620 400 L 600 400 L 580 400 L 560 400 L 540 400 L 520 400 L 500 400 L 480 400 z "
id="rect1990" />
<path
style="fill:#000000"
d="M 20 40 L 20 60 L 20 80 L 20 100 L 20 120 L 20 140 L 20 160 L 20 180 L 20 200 L 20 220 L 20 240 L 20 260 L 20 280 L 20 300 L 20 320 L 20 340 L 20 360 L 20 380 L 20 400 L 20 420 L 20 440 L 20 460 L 20 480 L 20 500 L 20 520 L 20 540 L 20 560 L 20 580 L 20 600 L 20 620 L 20 640 L 20 660 L 20 680 L 20 700 L 20 720 L 20 740 L 20 760 L 40 760 L 60 760 L 80 760 L 100 760 L 120 760 L 140 760 L 160 760 L 180 760 L 200 760 L 220 760 L 240 760 L 260 760 L 280 760 L 300 760 L 320 760 L 340 760 L 360 760 L 380 760 L 400 760 L 420 760 L 440 760 L 460 760 L 480 760 L 500 760 L 520 760 L 540 760 L 560 760 L 580 760 L 600 760 L 620 760 L 640 760 L 660 760 L 680 760 L 700 760 L 720 760 L 740 760 L 760 760 L 780 760 L 800 760 L 820 760 L 840 760 L 860 760 L 880 760 L 900 760 L 920 760 L 920 740 L 920 720 L 920 700 L 920 680 L 920 660 L 920 640 L 920 620 L 920 600 L 920 580 L 920 560 L 920 540 L 920 520 L 920 500 L 920 480 L 920 460 L 920 440 L 920 420 L 920 400 L 920 380 L 920 360 L 920 340 L 920 320 L 920 300 L 920 280 L 920 260 L 920 240 L 920 220 L 920 200 L 920 180 L 920 160 L 920 140 L 920 120 L 920 100 L 920 80 L 920 60 L 920 40 L 900 40 L 880 40 L 860 40 L 840 40 L 820 40 L 800 40 L 780 40 L 760 40 L 740 40 L 720 40 L 700 40 L 680 40 L 660 40 L 640 40 L 620 40 L 600 40 L 580 40 L 560 40 L 540 40 L 520 40 L 500 40 L 480 40 L 460 40 L 440 40 L 420 40 L 400 40 L 380 40 L 360 40 L 340 40 L 320 40 L 300 40 L 280 40 L 260 40 L 240 40 L 220 40 L 200 40 L 180 40 L 160 40 L 140 40 L 120 40 L 100 40 L 80 40 L 60 40 L 40 40 L 20 40 z M 60 60 L 80 60 L 100 60 L 120 60 L 120 80 L 120 100 L 120 120 L 100 120 L 80 120 L 60 120 L 60 100 L 60 80 L 60 60 z M 140 60 L 160 60 L 180 60 L 200 60 L 220 60 L 240 60 L 260 60 L 280 60 L 300 60 L 320 60 L 340 60 L 360 60 L 380 60 L 400 60 L 420 60 L 440 60 L 460 60 L 480 60 L 500 60 L 520 60 L 540 60 L 560 60 L 580 60 L 600 60 L 620 60 L 640 60 L 660 60 L 680 60 L 700 60 L 720 60 L 720 80 L 720 100 L 720 120 L 700 120 L 680 120 L 660 120 L 640 120 L 620 120 L 600 120 L 580 120 L 560 120 L 540 120 L 520 120 L 500 120 L 480 120 L 460 120 L 440 120 L 420 120 L 400 120 L 380 120 L 360 120 L 340 120 L 320 120 L 300 120 L 280 120 L 260 120 L 240 120 L 220 120 L 200 120 L 180 120 L 160 120 L 140 120 L 140 100 L 140 80 L 140 60 z M 740 60 L 760 60 L 780 60 L 800 60 L 800 80 L 800 100 L 800 120 L 780 120 L 760 120 L 740 120 L 740 100 L 740 80 L 740 60 z M 840 60 L 860 60 L 880 60 L 900 60 L 900 80 L 900 100 L 900 120 L 880 120 L 860 120 L 840 120 L 840 100 L 840 80 L 840 60 z M 180 260 L 200 260 L 220 260 L 240 260 L 260 260 L 260 280 L 280 280 L 280 300 L 260 300 L 260 280 L 240 280 L 220 280 L 200 280 L 180 280 L 180 300 L 180 320 L 180 340 L 180 360 L 180 380 L 180 400 L 200 400 L 220 400 L 240 400 L 260 400 L 260 380 L 280 380 L 280 400 L 260 400 L 260 420 L 240 420 L 220 420 L 200 420 L 180 420 L 180 400 L 160 400 L 160 380 L 160 360 L 160 340 L 160 320 L 160 300 L 160 280 L 180 280 L 180 260 z M 380 260 L 400 260 L 400 280 L 400 300 L 420 300 L 420 320 L 420 340 L 440 340 L 440 360 L 440 380 L 460 380 L 460 400 L 460 420 L 440 420 L 440 400 L 440 380 L 420 380 L 420 360 L 420 340 L 400 340 L 400 320 L 400 300 L 380 300 L 380 280 L 380 260 z M 340 300 L 360 300 L 360 320 L 340 320 L 340 300 z M 340 400 L 360 400 L 360 420 L 340 420 L 340 400 z M 480 400 L 500 400 L 520 400 L 540 400 L 560 400 L 580 400 L 600 400 L 620 400 L 640 400 L 660 400 L 680 400 L 680 420 L 660 420 L 640 420 L 620 420 L 600 420 L 580 420 L 560 420 L 540 420 L 520 420 L 500 420 L 480 420 L 480 400 z "
id="rect3646" />
<path
style="fill:#cbcbcb"
d="M 0 0 L 0 20 L 0 40 L 0 60 L 0 80 L 0 100 L 0 120 L 0 140 L 0 160 L 0 180 L 0 200 L 0 220 L 0 240 L 0 260 L 0 280 L 0 300 L 0 320 L 0 340 L 0 360 L 0 380 L 0 400 L 0 420 L 0 440 L 0 460 L 0 480 L 0 500 L 0 520 L 0 540 L 0 560 L 0 580 L 0 600 L 0 620 L 0 640 L 0 660 L 0 680 L 0 700 L 0 720 L 0 740 L 0 760 L 0 780 L 20 780 L 20 760 L 20 740 L 20 720 L 20 700 L 20 680 L 20 660 L 20 640 L 20 620 L 20 600 L 20 580 L 20 560 L 20 540 L 20 520 L 20 500 L 20 480 L 20 460 L 20 440 L 20 420 L 20 400 L 20 380 L 20 360 L 20 340 L 20 320 L 20 300 L 20 280 L 20 260 L 20 240 L 20 220 L 20 200 L 20 180 L 20 160 L 20 140 L 20 120 L 20 100 L 20 80 L 20 60 L 20 40 L 40 40 L 60 40 L 80 40 L 100 40 L 120 40 L 140 40 L 160 40 L 180 40 L 200 40 L 220 40 L 240 40 L 260 40 L 280 40 L 300 40 L 320 40 L 340 40 L 360 40 L 380 40 L 400 40 L 420 40 L 440 40 L 460 40 L 480 40 L 500 40 L 520 40 L 540 40 L 560 40 L 580 40 L 600 40 L 620 40 L 640 40 L 660 40 L 680 40 L 700 40 L 720 40 L 740 40 L 760 40 L 780 40 L 800 40 L 820 40 L 840 40 L 860 40 L 880 40 L 900 40 L 920 40 L 940 40 L 960 40 L 960 20 L 960 0 L 940 0 L 920 0 L 900 0 L 880 0 L 860 0 L 840 0 L 820 0 L 800 0 L 780 0 L 760 0 L 740 0 L 720 0 L 700 0 L 680 0 L 660 0 L 640 0 L 620 0 L 600 0 L 580 0 L 560 0 L 540 0 L 520 0 L 500 0 L 480 0 L 460 0 L 440 0 L 420 0 L 400 0 L 380 0 L 360 0 L 340 0 L 320 0 L 300 0 L 280 0 L 260 0 L 240 0 L 220 0 L 200 0 L 180 0 L 160 0 L 140 0 L 120 0 L 100 0 L 80 0 L 60 0 L 40 0 L 20 0 L 0 0 z M 60 60 L 60 80 L 60 100 L 80 100 L 100 100 L 100 80 L 100 60 L 80 60 L 60 60 z M 740 60 L 740 80 L 740 100 L 760 100 L 780 100 L 780 80 L 780 60 L 760 60 L 740 60 z M 840 60 L 840 80 L 840 100 L 860 100 L 880 100 L 880 80 L 880 60 L 860 60 L 840 60 z "
id="rect3652" />
<path
style="fill:#929292"
d="M 920 40 L 920 60 L 920 80 L 920 100 L 920 120 L 920 140 L 920 160 L 920 180 L 920 200 L 920 220 L 920 240 L 920 260 L 920 280 L 920 300 L 920 320 L 920 340 L 920 360 L 920 380 L 920 400 L 920 420 L 920 440 L 920 460 L 920 480 L 920 500 L 920 520 L 920 540 L 920 560 L 920 580 L 920 600 L 920 620 L 920 640 L 920 660 L 920 680 L 920 700 L 920 720 L 920 740 L 920 760 L 900 760 L 880 760 L 860 760 L 840 760 L 820 760 L 800 760 L 780 760 L 760 760 L 740 760 L 720 760 L 700 760 L 680 760 L 660 760 L 640 760 L 620 760 L 600 760 L 580 760 L 560 760 L 540 760 L 520 760 L 500 760 L 480 760 L 460 760 L 440 760 L 420 760 L 400 760 L 380 760 L 360 760 L 340 760 L 320 760 L 300 760 L 280 760 L 260 760 L 240 760 L 220 760 L 200 760 L 180 760 L 160 760 L 140 760 L 120 760 L 100 760 L 80 760 L 60 760 L 40 760 L 20 760 L 20 780 L 40 780 L 60 780 L 80 780 L 100 780 L 120 780 L 140 780 L 160 780 L 180 780 L 200 780 L 220 780 L 240 780 L 260 780 L 280 780 L 300 780 L 320 780 L 340 780 L 360 780 L 380 780 L 400 780 L 420 780 L 440 780 L 460 780 L 480 780 L 500 780 L 520 780 L 540 780 L 560 780 L 580 780 L 600 780 L 620 780 L 640 780 L 660 780 L 680 780 L 700 780 L 720 780 L 740 780 L 760 780 L 780 780 L 800 780 L 820 780 L 840 780 L 860 780 L 880 780 L 900 780 L 920 780 L 940 780 L 960 780 L 960 760 L 960 740 L 960 720 L 960 700 L 960 680 L 960 660 L 960 640 L 960 620 L 960 600 L 960 580 L 960 560 L 960 540 L 960 520 L 960 500 L 960 480 L 960 460 L 960 440 L 960 420 L 960 400 L 960 380 L 960 360 L 960 340 L 960 320 L 960 300 L 960 280 L 960 260 L 960 240 L 960 220 L 960 200 L 960 180 L 960 160 L 960 140 L 960 120 L 960 100 L 960 80 L 960 60 L 960 40 L 940 40 L 920 40 z M 100 60 L 100 80 L 100 100 L 80 100 L 60 100 L 60 120 L 80 120 L 100 120 L 120 120 L 120 100 L 120 80 L 120 60 L 100 60 z M 780 60 L 780 80 L 780 100 L 760 100 L 740 100 L 740 120 L 760 120 L 780 120 L 800 120 L 800 100 L 800 80 L 800 60 L 780 60 z M 880 60 L 880 80 L 880 100 L 860 100 L 840 100 L 840 120 L 860 120 L 880 120 L 900 120 L 900 100 L 900 80 L 900 60 L 880 60 z "
id="rect3746" />
</svg>

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,3 +1,4 @@
-- Reno98 - a retro replica of a very recognizable theme
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
@ -8,7 +9,7 @@ local themes_path = root_path.."/themes/"
local theme = {}
theme.font = "Liberation Sans 8"
theme.font = "Terminus 8"
theme.bg_normal = "#c0c0c0"
theme.bg_focus = "#808080"
@ -54,13 +55,9 @@ theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
)
theme.menu_height = dpi(15)
theme.menu_width = dpi(100)
theme.systray_icon_spacing = 2
-- Define the image to load
theme.titlebar_close_button_normal = themes_path.."reno98/titlebar/close_normal.png"
theme.titlebar_close_button_focus = themes_path.."reno98/titlebar/close_focus.png"
theme.titlebar_minimize_button_normal = themes_path.."reno98/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus = themes_path.."reno98/titlebar/minimize_focus.png"
theme.titlebar_ontop_button_normal_inactive = themes_path.."reno98/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = themes_path.."reno98/titlebar/ontop_focus_inactive.png"
@ -77,6 +74,15 @@ theme.titlebar_floating_button_focus_inactive = themes_path.."reno98/titlebar/f
theme.titlebar_floating_button_normal_active = themes_path.."reno98/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = themes_path.."reno98/titlebar/floating_focus_active.png"
theme = theme_assets.recolor_titlebar(theme,theme.fg_normal,"normal")
theme = theme_assets.recolor_titlebar(theme,theme.fg_focus,"focus")
theme.titlebar_close_button_normal = themes_path.."reno98/titlebar/close_normal.png"
theme.titlebar_close_button_focus = themes_path.."reno98/titlebar/close_focus.png"
theme.titlebar_minimize_button_normal = themes_path.."reno98/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus = themes_path.."reno98/titlebar/minimize_focus.png"
theme.titlebar_maximized_button_normal_inactive = themes_path.."reno98/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive = themes_path.."reno98/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = themes_path.."reno98/titlebar/maximized_normal_active.png"
@ -342,10 +348,34 @@ theme.widgets = {
margins = 0
}
},
root_menu = {
base = {
spacing = 2
}
},
client_menu = {
base = {
spacing = 2
}
},
taglist = {
base = {
spacing = 2
},
button = {
bgimage_focus = theme.bgimage_inset,
bgimage_normal = theme.bgimage_outset,
margins = 2
},
container = {
margins = 3
}
},
subpanel = {
container = {
bgimage = theme.bgimage_inset,
bg = theme.bgimage_normal
bg = theme.bgimage_normal,
margins = 2
}
},
dismal = {
@ -370,19 +400,26 @@ theme.widgets = {
base = {
-- Enables the ability to just drag the mouse on an entry to open it
menu_slide = true,
spacing = 1
spacing = 2
},
button = {
forced_height = 20,
forced_width = 160
},
popup = {
margins = 2
},
systray = {
container = {
bgimage = function() end,
margins = 0
}
},
root_menu = {
popup = {
margins = 2
client_buttons = {
button = {
forced_width = 20,
forced_height = 20
},
base = {
spacing = 2
}
},
titlebar = {

View File

@ -0,0 +1,17 @@
-- Base for widgets
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
return function(args)
local style = awmtk2.create_style("popuptitle",awmtk2.default,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({
icon = root_path.."/themes/"..global.theme.."/"..args.icon,
title = args.title
})))
return widget
end

16
widgets/base/systray.lua Normal file
View File

@ -0,0 +1,16 @@
-- Base for widgets
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
return function(args)
local style = awmtk2.create_style("systray",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("systray",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container({
widget = wibox.widget.systray
}))
return widget
end

View File

@ -0,0 +1,58 @@
-- Base for widgets
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
return function(args)
local style = awmtk2.create_style("taglist",awmtk2.default,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({
screen = args.screen,
filter = awful.widget.taglist.filter.all,
style = {
shape = style.button.shape
},
layout = {
spacing = style.base.spacing,
spacing_widget = style.base.spacing_widget,
layout = style.base.layout or wibox.layout.fixed.horizontal
},
widget_template = t.button(t.article({
icon_id = "icon_role",
title_id = "text_role"
}),{
id = "background",
create_callback = function(self, tag, index, tags)
self:connect_signal("button::press",function(self,x,y,b)
if b == 1 then
awful.tag.viewmore({tag})
elseif b == 3 then
awful.tag.viewtoggle(tag)
end
end)
local bg = self:get_children_by_id("background")[1]
if tag.selected then
bg.bgimage = style.button.bgimage_focus
bg.bg = style.button.bg_focus
else
bg.bgimage = style.button.bgimage_normal
bg.bg = style.button.bg_normal
end
end,
update_callback = function(self, tag, index, tags)
local bg = self:get_children_by_id("background")[1]
if tag.selected then
bg.bgimage = style.button.bgimage_focus
bg.bg = style.button.bg_focus
else
bg.bgimage = style.button.bgimage_normal
bg.bg = style.button.bg_normal
end
end
})
})))
return widget
end

85
widgets/clientbuttons.lua Normal file
View File

@ -0,0 +1,85 @@
--
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
return function(args)
local style = awmtk2.create_style("client_buttons",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("client_buttons",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local floating_on = beautiful.titlebar_floating_button_normal_inactive
local floating_off = beautiful.titlebar_floating_button_normal_active
local ontop_on = beautiful.titlebar_ontop_button_normal_inactive
local ontop_off = beautiful.titlebar_ontop_button_normal_active
local sticky_on = beautiful.titlebar_sticky_button_normal_inactive
local sticky_off = beautiful.titlebar_sticky_button_normal_active
local floating = wibox.widget(t.button({
image = (client.focus and client.focus.floating and floating_on) or floating_off,
widget = wibox.widget.imagebox,
id = "icon"
},{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
floating:connect_signal("button::press",style.button.onpress)
floating:connect_signal("button::release",style.button.onrelease)
floating:connect_signal("button::press",function(widget)
client.focus.floating = (not client.focus.floating)
widget:emit_signal("widget::update",widget)
end)
floating:connect_signal("widget::update",function(widget)
local icon = widget:get_children_by_id("icon")[1]
icon.image = (client.focus.floating and floating_on) or floating_off
end)
local ontop = wibox.widget(t.button({
image = (client.focus and client.focus.ontop and ontop_on) or ontop_off,
widget = wibox.widget.imagebox,
id = "icon"
},{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
ontop:connect_signal("button::press",style.button.onpress)
ontop:connect_signal("button::release",style.button.onrelease)
ontop:connect_signal("button::press",function(widget)
client.focus.ontop = (not client.focus.ontop)
widget:emit_signal("widget::update",widget)
end)
ontop:connect_signal("widget::update",function(widget)
local icon = widget:get_children_by_id("icon")[1]
icon.image = (client.focus.ontop and ontop_on) or ontop_off
end)
local sticky = wibox.widget(t.button({
image = (client.focus and client.focus.sticky and sticky_on) or sticky_off,
widget = wibox.widget.imagebox,
id = "icon"
},{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
sticky:connect_signal("button::press",style.button.onpress)
sticky:connect_signal("button::release",style.button.onrelease)
sticky:connect_signal("button::press",function(widget)
client.focus.sticky = (not client.focus.sticky)
widget:emit_signal("widget::update",widget)
end)
sticky:connect_signal("widget::update",function(widget)
local icon = widget:get_children_by_id("icon")[1]
icon.image = (client.focus.sticky and sticky_on) or sticky_off
end)
client.connect_signal("focus",function(c)
sticky:emit_signal("widget::update")
ontop:emit_signal("widget::update")
floating:emit_signal("widget::update")
end)
local widget = wibox.widget({
floating,
ontop,
sticky,
layout = wibox.layout.fixed.horizontal,
spacing = style.base.spacing
})
return widget
end

View File

@ -0,0 +1,64 @@
-- Basic client control keys
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local menugen = require("context_menu")
return function(args)
local style = awmtk2.create_style("client_controls",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("client_controls",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local move_to_tag = {}
local add_to_tag = {}
awful.screen.connect_for_each_screen(function(s)
table.insert(move_to_tag,{
"Screen "..s.index,
(function()
local t = {}
for k,v in pairs(s.tags) do
table.insert(t,{v.name,function()
if client.focus then
client.focus:tags({v})
end
end})
end
return t
end)()
})
table.insert(add_to_tag,{
"Screen "..s.index,
(function()
local t = {}
for k,v in pairs(s.tags) do
table.insert(t,{v.name,function()
if client.focus then
local tags = client.focus:tags()
for k,tag in pairs(tags) do
if v == tag then
table.remove(tags,k)
client.focus:tags(tags)
return
end
end
table.insert(tags,v)
client.focus:tags(tags)
end
end})
end
return t
end)()
})
end)
local widget = menugen({
items = {
{ "Kill client", function() client.focus:kill() end },
{ "Raise client", function() client.focus:raise() end},
{ "Lower client", function() client.focus:lower() end},
{ "Move to tag", move_to_tag },
{ "Switch on tag", add_to_tag }
},
})
return widget
end

69
widgets/clientmenu.lua Normal file
View File

@ -0,0 +1,69 @@
-- Base for widgets
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local menugen = require("context_menu")
local builder = require("builder")
local style = awmtk2.create_style("client_menu",awmtk2.default,{})
local templates = awmtk2.create_template_lib("client_menu",awmtk2.templates,{})
local t = awmtk2.build_templates(templates,style)
-- Create a global context menu for clients first
if not context_menu then
local config_file = io.open(root_path.."/themes/"..global.theme..'/config/client_menu.json',"r")
local config
if config_file then
config = config_file:read("*a")
config_file:close()
else
config = [[{"list":[{"widget":"widgets.clientcontrols"}]}]]
end
context_menu = awful.popup(t.popup(builder(
config,
{
style = style.base,
}
)))
context_menu:connect_signal("button::press",function(self,x,y,b)
if b == 3 then
context_menu.visible = false
end
end)
context_menu:connect_signal("property::visible",function(self,x,y,b)
if not context_menu.visible then
local children = context_menu.widget:get_children_by_id("menu_root")
for k,v in pairs(children) do
for k2,v2 in pairs(v.children) do
v2:emit_signal("cascade::close")
end
end
end
end)
client.connect_signal("focus",function()
context_menu.visible = false
end)
for _,layout in pairs(context_menu.widget:get_children_by_id("menu_root")) do
for _,button in pairs(layout.children) do
button:connect_signal("cascade::kill",function()
context_menu.visible = false
end)
end
end
end
return function(args)
local widget = wibox.widget({
widget = awful.widget.clienticon,
client = args.client
})
widget:connect_signal("button::press",function()
context_menu.visible = (not context_menu.visible)
if context_menu.visible then
context_menu.x = mouse.coords().x
context_menu.y = mouse.coords().y
end
end)
return widget
end

85
widgets/rootbuttons.lua Normal file
View File

@ -0,0 +1,85 @@
--
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
return function(args)
local style = awmtk2.create_style("client_buttons",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("client_buttons",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local floating_on = beautiful.titlebar_floating_button_normal_inactive
local floating_off = beautiful.titlebar_floating_button_normal_active
local ontop_on = beautiful.titlebar_ontop_button_normal_inactive
local ontop_off = beautiful.titlebar_ontop_button_normal_active
local sticky_on = beautiful.titlebar_sticky_button_normal_inactive
local sticky_off = beautiful.titlebar_sticky_button_normal_active
local floating = wibox.widget(t.button({
image = (client.focus and client.focus.floating and floating_on) or floating_off,
widget = wibox.widget.imagebox,
id = "icon"
},{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
floating:connect_signal("button::press",style.button.onpress)
floating:connect_signal("button::release",style.button.onrelease)
floating:connect_signal("button::press",function(widget)
client.focus.floating = (not client.focus.floating)
widget:emit_signal("widget::update",widget)
end)
floating:connect_signal("widget::update",function(widget)
local icon = widget:get_children_by_id("icon")[1]
icon.image = (client.focus.floating and floating_on) or floating_off
end)
local ontop = wibox.widget(t.button({
image = (client.focus and client.focus.ontop and ontop_on) or ontop_off,
widget = wibox.widget.imagebox,
id = "icon"
},{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
ontop:connect_signal("button::press",style.button.onpress)
ontop:connect_signal("button::release",style.button.onrelease)
ontop:connect_signal("button::press",function(widget)
client.focus.ontop = (not client.focus.ontop)
widget:emit_signal("widget::update",widget)
end)
ontop:connect_signal("widget::update",function(widget)
local icon = widget:get_children_by_id("icon")[1]
icon.image = (client.focus.ontop and ontop_on) or ontop_off
end)
local sticky = wibox.widget(t.button({
image = (client.focus and client.focus.sticky and sticky_on) or sticky_off,
widget = wibox.widget.imagebox,
id = "icon"
},{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
sticky:connect_signal("button::press",style.button.onpress)
sticky:connect_signal("button::release",style.button.onrelease)
sticky:connect_signal("button::press",function(widget)
client.focus.sticky = (not client.focus.sticky)
widget:emit_signal("widget::update",widget)
end)
sticky:connect_signal("widget::update",function(widget)
local icon = widget:get_children_by_id("icon")[1]
icon.image = (client.focus.sticky and sticky_on) or sticky_off
end)
client.connect_signal("focus",function(c)
sticky:emit_signal("widget::update")
ontop:emit_signal("widget::update")
floating:emit_signal("widget::update")
end)
local widget = wibox.widget({
floating,
ontop,
sticky,
layout = wibox.layout.fixed.horizontal,
spacing = style.base.spacing
})
return widget
end

25
widgets/rootcontrols.lua Normal file
View File

@ -0,0 +1,25 @@
-- Base for widgets
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local menugen = require("context_menu")
return function(args)
local style = awmtk2.create_style("root_menu",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local widget = menugen({
items = {
{"Awesome", {
{"open config dir", "xdg-open "..root_path},
{"open docs", "xdg-open https://awesomewm.org/doc/api/"},
{"restart", function() awesome.restart() end},
{"quit", function() awesome.quit() end}
}, beautiful.awesome_icon},
{"open terminal", global.terminal}
},
})
return widget
end

View File

@ -1,25 +1,71 @@
-- Base for widgets
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local menugen = require("context_menu")
local builder = require("builder")
return function(args)
local style = awmtk2.create_style("root_menu",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,args.templates)
local style = awmtk2.create_style("root_menu",awmtk2.default,{})
local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,{})
local t = awmtk2.build_templates(templates,style)
local widget = menugen({
items = {
{"Awesome", {
{"open config dir", "xdg-open "..root_path},
{"open docs", "xdg-open https://awesomewm.org/doc/api/"},
{"restart", function() awesome.restart() end},
{"quit", function() awesome.quit() end}
}, beautiful.awesome_icon},
{"open terminal", global.terminal}
}
})
return widget
end
local config_file = io.open(root_path.."/themes/"..global.theme.."/config/root_menu.json","r")
local config
if config_file then
config = config_file:read("*a")
config_file:close()
else
config = [[{"list": [{"widget": "widgets.rootcontrols"}],"vertical": true}]]
end
-- TODO: Refactor this whole mess
root_menu = awful.popup(t.popup({
markup = "brainhurt the game",
widget = wibox.widget.textbox
}))
root_menu:connect_signal("button::press",function(self,x,y,b)
if b == 3 then
root_menu.visible = false
end
end)
root_menu._menu_private = {}
root_menu.widget = wibox.widget(t.popup(builder(
config,
{
style = style.base,
screen = mouse.screen,
passthrough = {
parent = root_menu,
_tracking_layer = root_menu._menu_private
}
}
)).widget)
for _,layout in pairs(root_menu.widget:get_children_by_id("menu_root")) do
print(layout)
for _,button in pairs(layout.children) do
button:connect_signal("cascade::kill",function()
root_menu.visible = false
end)
end
end
root_menu:connect_signal("property::visible",function()
local roots = root_menu.widget:get_children_by_id("menu_root")
for k,v in pairs(roots) do
for _,w in ipairs(v.children) do
w:emit_signal("cascade::close")
end
end
end)
local buttons = root.buttons()
root.buttons(gears.table.join(buttons,
awful.button({}, 3, function()
root_menu.visible = (not root_menu.visible)
if root_menu.visible then
root_menu:move_next_to(gears.table.join(mouse.coords(),{
width = 0,
height = 0
}))
end
end)
))
return root_menu
end

99
widgets/xdgmenu.lua Normal file
View File

@ -0,0 +1,99 @@
-- Generic application menu
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local menugen = require("context_menu")
local menuutils = require("menubar").utils
return function(args)
local style = awmtk2.create_style("xdg_menu",awmtk2.default,args.style)
local templates = awmtk2.create_template_lib("xdg_menu",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
-- Add a "loading" indicator while XDG is still parsing data
local widget = wibox.widget({
t.container({
markup = "Loading XDG menu...",
widget = wibox.widget.textbox
}),
layout = wibox.layout.fixed.vertical,
id = "xdg_menu_root"
})
local function exclude(name)
for k,v in pairs(args.exclude or {}) do
if name:match(v) then
return true
end
end
return false
end
awesome.connect_signal("xdg::all_finished",function()
if not args.parent then return end
local items = {}
for k,v in pairs(xdg.categories) do
local noprocess = false
for k2,v2 in pairs(args.exclude_category or {}) do
if k == v2 then
noprocess = true
end
end
if (not noprocess) and (#v.apps > 0) then
local category = {k,{},menuutils.lookup_icon_uncached(v.icon)}
for _,item in pairs(v.apps) do
if not exclude(item.name) then
table.insert(category[2], {
item.name,
item.exec:gsub("%%%w","") or "",
gears.filesystem.file_readable(item.icon or "") and item.icon
})
end
end
table.insert(items,category)
end
end
-- uhhh there's a lot of things about async, some of which i can't explain
local xdg_menu_root = widget:get_children_by_id("xdg_menu_root")[1]
xdg_menu_root:reset()
local menu = wibox.widget(menugen({
items = items,
}))
local menu_root = menu:get_children_by_id("menu_root")[1]
for k,v in pairs(menu_root.children) do
v:connect_signal("cascade::kill",function()
args.parent.visible = false
end)
args.parent:connect_signal("property::visible",function()
if not args.parent.visible then
v:emit_signal("cascade::close")
end
end)
menu:connect_signal("widget::redraw_needed",function()
if not menu.visible then
v:emit_signal("cascade::close")
end
end)
end
local appswitch = wibox.widget(t.button(t.textbox({
markup = "Applications",
id = "apptext"
})))
appswitch:connect_signal("button::press",function(self)
menu.visible = (not menu.visible)
local textbox = appswitch:get_children_by_id("apptext")[1]
if menu.visible then
style.button.onpress(self)
textbox:set_markup("<b>Applications</b>")
else
style.button.onrelease(self)
textbox:set_markup("Applications")
end
end)
menu.visible = false
xdg_menu_root:add(appswitch)
xdg_menu_root:add(menu)
end)
return widget
end