From: Samir Benmendil Date: Mon, 13 Mar 2017 00:12:05 +0000 (+0000) Subject: awesome: update topbar.lua X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/0e766a63a41217b27a93ae980452cc2d4dd52e37?ds=inline awesome: update topbar.lua --- diff --git a/awesome/topbar.lua b/awesome/topbar.lua index 938e7ed..27493b3 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -8,6 +8,19 @@ local wibox = require("wibox") separator = wibox.widget.textbox() separator:set_markup('│') +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 + -- Wibox {{{1 -- Create a wibox for each screen and add it local taglist_buttons = awful.util.table.join( @@ -45,14 +58,7 @@ local tasklist_buttons = awful.util.table.join( end end), awful.button({ }, 2, function (c) c:kill() end), - awful.button({ }, 3, function () - if instance and instance.wibox.visible 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), @@ -68,10 +74,10 @@ awful.screen.connect_for_each_screen(function(s) -- We need one layoutbox per screen. s.mylayoutbox = awful.widget.layoutbox(s) s.mylayoutbox:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), - awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end))) -- Create a taglist widget s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) @@ -86,7 +92,6 @@ awful.screen.connect_for_each_screen(function(s) layout = wibox.layout.align.horizontal, { -- Left widgets layout = wibox.layout.fixed.horizontal, - -- mylauncher, s.mytaglist, s.mypromptbox, },