|
|
@ -53,13 +53,14 @@ return function(args) |
|
|
|
local onpress = function(widget) |
|
|
|
style.button.onrelease(widget) |
|
|
|
widget:emit_signal("cascade::kill") |
|
|
|
if root_layer.focused then |
|
|
|
root_layer.focused:emit_signal("cascade::kill") |
|
|
|
if root_layer._private.focused then |
|
|
|
root_layer._private.focused:emit_signal("cascade::kill") |
|
|
|
root_layer: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) |
|
|
|
new_element:connect_signal("button::press",function() |
|
|
|
awful.spawn(element[2]) |
|
|
|
end) |
|
|
|
new_element:connect_signal("button::release",onpress) |
|
|
@ -68,12 +69,12 @@ return function(args) |
|
|
|
new_element:connect_signal("button::press",element[2]) |
|
|
|
new_element:connect_signal("button::release",onpress) |
|
|
|
elseif type(element[2]) == "table" then |
|
|
|
local layout = { |
|
|
|
local layout = wibox.widget({ |
|
|
|
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)) |
|
|
|
}) |
|
|
|
for _,v in pairs(element[2]) do |
|
|
|
layout:add(menu_builder(v,layout,root_layer)) |
|
|
|
end |
|
|
|
local next_layer = awful.popup(t.popup(layout,{ |
|
|
|
visible = false, |
|
|
@ -82,25 +83,27 @@ return function(args) |
|
|
|
preferred_anchors = {"front","back"}, |
|
|
|
})) |
|
|
|
local function open_layer(widget) |
|
|
|
if layer.focused == widget and |
|
|
|
if layer._private.focused == widget and |
|
|
|
next_layer.visible then |
|
|
|
return |
|
|
|
end |
|
|
|
if layer.focused then |
|
|
|
layer.focused:emit_signal("cascade::close") |
|
|
|
if layer._private.focused then |
|
|
|
layer._private.focused:emit_signal("cascade::close") |
|
|
|
end |
|
|
|
layer.focused = widget |
|
|
|
layer._private.focused = widget |
|
|
|
position_popup(next_layer, new_element, style) |
|
|
|
end |
|
|
|
local onclose = function() |
|
|
|
style.button.onrelease(new_element) |
|
|
|
if layout.focused then |
|
|
|
layout.focused:emit_signal("cascade::close") |
|
|
|
if layout._private.focused then |
|
|
|
layout._private.focused:emit_signal("cascade::close") |
|
|
|
end |
|
|
|
next_layer.visible = false |
|
|
|
end |
|
|
|
new_element:connect_signal("cascade::close",onclose) |
|
|
|
new_element:connect_signal("cascade::kill",onclose) |
|
|
|
root_layer:connect_signal("cascade::kill",onclose) |
|
|
|
root_layer:connect_signal("cascade::close",onclose) |
|
|
|
-- that sweet "just move the mouse 4head" navigation |
|
|
|
if style.base.menu_slide then |
|
|
|
new_element:connect_signal("mouse::enter",open_layer) |
|
|
@ -112,13 +115,13 @@ return function(args) |
|
|
|
end |
|
|
|
return new_element |
|
|
|
end |
|
|
|
local root_layer = { |
|
|
|
local root_layer = args.parent or wibox.widget { |
|
|
|
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)) |
|
|
|
for _,v in pairs(args.items) do |
|
|
|
root_layer:add(menu_builder(v,root_layer,root_layer)) |
|
|
|
end |
|
|
|
return root_layer |
|
|
|
end |