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.
64 lines
2.3 KiB
64 lines
2.3 KiB
-- 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
|