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.
66 lines
2.7 KiB
66 lines
2.7 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 awful = require("awful")
|
|
local menugen = require("context_menu")
|
|
|
|
return function(args)
|
|
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 _,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 _,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 = {
|
|
{ "Terminate client", function() client.focus:kill() end },
|
|
{ "Kill client", function() awful.spawn("kill -KILL "..tostring(client.focus.pid)) end },
|
|
{ "Toggle above", function() client.focus.above = (not client.focus.above) end},
|
|
{ "Toggle below", function() client.focus.below = (not client.focus.below) end},
|
|
{ "Move to tag", move_to_tag },
|
|
{ "Switch on tag", add_to_tag }
|
|
},
|
|
parent = args.menu_parent
|
|
})
|
|
return widget
|
|
end
|