Root menu added + minor fixes

This commit is contained in:
Yessiest 2022-08-23 17:03:15 +04:00
parent 70491cb4ac
commit 7bac292408
9 changed files with 274 additions and 12 deletions

View File

@ -141,6 +141,10 @@ awmtk.proto_style.titlebar = awmtk.create_delta("titlebar", {
awmtk.proto_style.wibar = awmtk.create_delta("wibar", {
margins = 1
}, awmtk.proto_style,awmtk.proto_style.base)
awmtk.proto_style.menu = awmtk.create_delta("menu", {
margins = 1
}, awmtk.proto_style,awmtk.proto_style.base)
-- }}}
-- {{{ Generic templates
@ -224,7 +228,7 @@ awmtk.proto_templates = {
article = function(style)
-- Article is a template that combines 3 common pieces of a full item:
-- Icon, name and description. Designed to be placed within a container
-- or a button. Also supports usage in tasklist via _id suffixes.
-- or a button.
return function(options)
return awmtk.merge({
(options.icon and {
@ -339,7 +343,7 @@ awmtk.proto_templates = {
top = style.wibar.top
},options or {})
end
end,
end
}
-- Last but not least - we export a default template lib and default style.

117
libs/context_menu.lua Normal file
View File

@ -0,0 +1,117 @@
-- POLYMENU - brutal deluxe
-- This isn't in the widgets folder because it's too meta to be there
local awful = require("awful")
local gears = require("gears")
local menubar_utils = require("menubar.utils")
local wibox = require("wibox")
local awmtk2 = require("awmtk2")
local function position_popup(popup,widget,style)
-- Position the popup somewhere nearby our original widget
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
if widget == v then
widget_geo = mouse.current_widget_geometries[k]
end
end
-- Align y coordinate of the popup to the button
if widget_geo then
local wibox_geo = mouse.current_wibox:geometry()
if popup.current_anchor == "front" then
popup.y = widget_geo.y + wibox_geo.y - style.popup.margins
else
popup.y = widget_geo.y + wibox_geo.y + style.popup.margins + widget_geo.height - popup:geometry().height
end
end
-- Finally, make widget visible
popup.visible = true
end
return function(args)
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)
local function menu_builder(element,layer,root_layer)
local new_element = wibox.widget(t.button(t.article({
icon = element[3],
resize = true,
title = element[1]
}),{
forced_width = style.button.forced_width,
forced_height = style.button.forced_height
}))
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)
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)
elseif type(element[2]) == "table" then
local layout = {
spacing = style.base.spacing,
layout = wibox.layout.fixed.vertical
}
for k,v in pairs(element[2]) do
table.insert(layout,menu_builder(v,layout,root_layer))
end
local next_layer = awful.popup(t.popup(layout,{
visible = false,
ontop = true,
preferred_positions = {"right","left"},
preferred_anchors = {"front","back"},
}))
local function open_layer(widget)
if layer.focused == widget and
next_layer.visible then
return
end
if layer.focused then
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()
style.button.onrelease(new_element)
if layout.focused then
layout.focused:emit_signal("cascade_close")
end
next_layer.visible = false
end)
-- that sweet "just move the mouse 4head" navigation
if style.base.menu_slide then
new_element:connect_signal("mouse::enter",open_layer)
new_element:connect_signal("mouse::enter",style.button.onpress)
else
new_element:connect_signal("button::press",style.button.onpress)
new_element:connect_signal("button::press",open_layer)
end
end
return new_element
end
local root_layer = {
layout = wibox.layout.fixed.vertical,
id = "menu_root",
spacing = style.base.spacing
}
for k,v in pairs(args.items) do
table.insert(root_layer,menu_builder(v,root_layer,root_layer))
end
return root_layer
end

View File

@ -5,6 +5,7 @@ local awful = require("awful")
local beautiful = require("beautiful")
local builder = require("builder")
local mbarutils = require("menubar").utils
local menugen = require("context_menu")
local function read_file(fname)
local fhandler = io.open(fname,"r")
@ -14,13 +15,58 @@ local function read_file(fname)
return data
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
local icon = gears.surface(beautiful.icon_default)
if icon then
c.icon = icon._native
end
c.icon = beautiful.icon_default._native
end
end)
-- }}}
@ -67,6 +113,7 @@ client.connect_signal("request::titlebars",function(c)
if titlebar_config[v] then
contents = builder(titlebar_config[v],{
client = c,
screen = c.screen,
style = style[v],
buttons = buttons
})
@ -113,8 +160,8 @@ awful.screen.connect_for_each_screen(function(s)
position = v:gsub("wibar_",""),
screen = s,
visible = true,
stretch = style[v].stretch or true,
ontop = style[v].ontop or true,
stretch = style[v].stretch,
ontop = style[v].ontop,
width = style[v].width,
height = style[v].height,
border_width = style[v].border_width,

View File

@ -135,7 +135,8 @@ theme.widgets = {
wibar = {
height = 24,
margins = 2,
width = 60
width = 60,
stretch = true
}
},
titlebar = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

View File

@ -0,0 +1,45 @@
<?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>

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -285,7 +285,8 @@ end
theme.icon_theme = "Chicago95"
-- Default icon for clients
theme.icon_default = "/usr/share/icons/Chicago95/apps/22/terminal.png"
-- This one has to be baked as a surface to avoid memory leaks
theme.icon_default = gears.surface(themes_path.."reno98/icons/unknown-app.png")
theme.widgets = {
default = {
@ -331,7 +332,8 @@ theme.widgets = {
shape = function(cr,width,height)
return gears.shape.rounded_rect(cr,width,height,0)
end,
bgimage = theme.bgimage_outset
bgimage = theme.bgimage_outset,
stretch = true
}
},
clock = {
@ -364,6 +366,25 @@ theme.widgets = {
bgimage_minimize = theme.bgimage_outset
}
},
menu = {
base = {
-- Enables the ability to just drag the mouse on an entry to open it
menu_slide = true,
spacing = 1
},
button = {
forced_height = 20,
forced_width = 160
},
popup = {
margins = 2
}
},
root_menu = {
popup = {
margins = 2
}
},
titlebar = {
titlebar_top = {
bgimage_normal = theme.titlebar_bgimage_top,

25
widgets/rootmenu.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

@ -96,7 +96,9 @@ return function(args)
c:connect_signal("unfocus",onunfocus)
c:connect_signal("property::urgent",onurgent)
c:connect_signal("property::minimized",onminimize)
if client.focus == c then
onfocus()
end
end,
-- Uncomment this only, and **ONLY** if you actually need it.
--id = "background_role"