Fixed "undead" window menus and made the windows use less resources
This commit is contained in:
parent
5a78139515
commit
8166cca713
|
@ -43,6 +43,37 @@ awful.screen.connect_for_each_screen(function(s)
|
||||||
toggle_tags
|
toggle_tags
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
local controls_widget = wibox.widget {
|
||||||
|
forced_width = 72,
|
||||||
|
forced_height = 24,
|
||||||
|
layout = wibox.layout.fixed.horizontal,
|
||||||
|
}
|
||||||
|
-- To conserve memory we keep one menu at a time
|
||||||
|
local menu_widget = menu({
|
||||||
|
before = {
|
||||||
|
controls_widget
|
||||||
|
},
|
||||||
|
items = {
|
||||||
|
{ "Move to tag" ,
|
||||||
|
move_screentags
|
||||||
|
},
|
||||||
|
{ "Toggle on tag",
|
||||||
|
toggle_screentags
|
||||||
|
},
|
||||||
|
{ "Stop task",
|
||||||
|
function()
|
||||||
|
awful.spawn("kill "..tostring(c.pid))
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{ "Kill task",
|
||||||
|
function()
|
||||||
|
awful.spawn("kill -s KILL "..tostring(c.pid))
|
||||||
|
end
|
||||||
|
}
|
||||||
|
},
|
||||||
|
vertical = true
|
||||||
|
})
|
||||||
|
|
||||||
return function(c)
|
return function(c)
|
||||||
local buttons = gears.table.join(
|
local buttons = gears.table.join(
|
||||||
awful.button({ }, 1, function()
|
awful.button({ }, 1, function()
|
||||||
|
@ -54,45 +85,26 @@ return function(c)
|
||||||
awful.mouse.client.resize(c)
|
awful.mouse.client.resize(c)
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
c.menu = menu({
|
|
||||||
before = {
|
|
||||||
{
|
|
||||||
awful.titlebar.widget.floatingbutton (c),
|
|
||||||
awful.titlebar.widget.stickybutton (c),
|
|
||||||
awful.titlebar.widget.ontopbutton (c),
|
|
||||||
forced_width = 72,
|
|
||||||
forced_height = 24,
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
items = {
|
|
||||||
{ "Move to tag" ,
|
|
||||||
move_screentags
|
|
||||||
},
|
|
||||||
{ "Toggle on tag",
|
|
||||||
toggle_screentags
|
|
||||||
},
|
|
||||||
{ "Stop task",
|
|
||||||
function()
|
|
||||||
awful.spawn("kill "..tostring(c.pid))
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{ "Kill task",
|
|
||||||
function()
|
|
||||||
awful.spawn("kill -s KILL "..tostring(c.pid))
|
|
||||||
end
|
|
||||||
}
|
|
||||||
},
|
|
||||||
vertical = true
|
|
||||||
})
|
|
||||||
c.menu_button = awful.titlebar.widget.iconwidget(c)
|
c.menu_button = awful.titlebar.widget.iconwidget(c)
|
||||||
|
-- A little trick we do to conserve memory and cpu usage on regenerating
|
||||||
|
-- buttons is we pop up a menu in the location of the icon
|
||||||
|
-- and insert buttons into the controls widget layout.
|
||||||
|
c.hidden_floatingbutton = awful.titlebar.widget.floatingbutton(c)
|
||||||
|
c.hidden_stickybutton = awful.titlebar.widget.stickybutton(c)
|
||||||
|
c.hidden_ontopbutton = awful.titlebar.widget.ontopbutton(c)
|
||||||
c.menu_button:connect_signal("button::press", function()
|
c.menu_button:connect_signal("button::press", function()
|
||||||
c.menu.toggle()
|
menu_widget.toggle()
|
||||||
|
if controls_widget then
|
||||||
|
controls_widget:reset()
|
||||||
|
controls_widget:add(c.hidden_floatingbutton)
|
||||||
|
controls_widget:add(c.hidden_stickybutton)
|
||||||
|
controls_widget:add(c.hidden_ontopbutton)
|
||||||
|
end
|
||||||
c:emit_signal("request::activate", "titlebar", {raise = true})
|
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||||
end)
|
end)
|
||||||
c:connect_signal("unfocus",function()
|
c:connect_signal("unfocus",function()
|
||||||
if c.menu.visible then
|
if menu_widget.visible then
|
||||||
c.menu.toggle(0,0)
|
menu_widget.toggle(0,0)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
return awful.titlebar(c) : setup {
|
return awful.titlebar(c) : setup {
|
||||||
|
|
Loading…
Reference in New Issue