Reno is the second iteration of the AWMTK-powered AwesomeWM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
2.1 KiB

-- 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