From 09de5c8f53f498d50eac0d3473376a10db754330 Mon Sep 17 00:00:00 2001 From: Clemens Kirchgatterer Date: Sun, 13 Sep 2015 10:58:44 +0200 Subject: [PATCH 1/2] fix #420 (clients menu does not reopen instantly after closewith ESC) --- awesomerc.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/awesomerc.lua b/awesomerc.lua index d9c7d079..315dc61c 100755 --- a/awesomerc.lua +++ b/awesomerc.lua @@ -73,6 +73,18 @@ awful.layout.layouts = { } -- }}} +-- {{{ Helper functions +local client_menu_instance = nil +local function client_menu_toggle() + if client_menu_instance and client_menu_instance.wibox.visible then + client_menu_instance:hide() + client_menu_instance = nil + else + client_menu_instance = awful.menu.clients({ theme = { width = 250 } }) + end +end +-- }}} + -- {{{ Wallpaper if beautiful.wallpaper then for s = 1, screen.count() do @@ -130,7 +142,8 @@ mytaglist.buttons = awful.util.table.join( awful.button({ modkey }, 3, awful.client.toggletag), awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end), awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end) - ) + ) + mytasklist = {} mytasklist.buttons = awful.util.table.join( awful.button({ }, 1, function (c) @@ -150,14 +163,7 @@ mytasklist.buttons = awful.util.table.join( end end), awful.button({ }, 3, function () - if instance then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ - theme = { width = 250 } - }) - end + client_menu_toggle() end), awful.button({ }, 4, function () awful.client.focus.byidx(1) From 702fa1967c26cdd7c372c94d53e9b53c1cb730a6 Mon Sep 17 00:00:00 2001 From: Clemens Kirchgatterer Date: Sun, 13 Sep 2015 14:47:16 +0200 Subject: [PATCH 2/2] Improved fix for #240 by makeing instance local to client_menu_toggle_fn --- awesomerc.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/awesomerc.lua b/awesomerc.lua index 315dc61c..b4a16518 100755 --- a/awesomerc.lua +++ b/awesomerc.lua @@ -74,13 +74,16 @@ awful.layout.layouts = { -- }}} -- {{{ Helper functions -local client_menu_instance = nil -local function client_menu_toggle() - if client_menu_instance and client_menu_instance.wibox.visible then - client_menu_instance:hide() - client_menu_instance = nil - else - client_menu_instance = awful.menu.clients({ theme = { width = 250 } }) +local function client_menu_toggle_fn() + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({ theme = { width = 250 } }) + end end end -- }}} @@ -162,9 +165,7 @@ mytasklist.buttons = awful.util.table.join( c:raise() end end), - awful.button({ }, 3, function () - client_menu_toggle() - end), + awful.button({ }, 3, client_menu_toggle_fn()), awful.button({ }, 4, function () awful.client.focus.byidx(1) end),