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.
72 lines
2.9 KiB
72 lines
2.9 KiB
-- This file is part of Reno desktop.
|
|
--
|
|
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
--
|
|
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
|
|
-- Basic client control 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")
|
|
|
|
return function(args)
|
|
local style = awmtk2.create_style("client_controls",
|
|
awmtk2.generic.menu,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
|