diff --git a/awesomerc.lua b/awesomerc.lua index 6a28cf1b6..18a3595b4 100755 --- a/awesomerc.lua +++ b/awesomerc.lua @@ -73,6 +73,21 @@ awful.layout.layouts = { } -- }}} +-- {{{ Helper functions +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 +-- }}} + -- {{{ Wallpaper if beautiful.wallpaper then for s = 1, screen.count() do @@ -130,7 +145,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) @@ -149,16 +165,7 @@ mytasklist.buttons = awful.util.table.join( c:raise() end end), - awful.button({ }, 3, function () - if instance then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ - theme = { width = 250 } - }) - end - end), + awful.button({ }, 3, client_menu_toggle_fn()), awful.button({ }, 4, function () awful.client.focus.byidx(1) end),