From 5713a196020383020e31f140d7d90f4071ed9860 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 16 Oct 2019 03:04:37 -0400 Subject: [PATCH] rc.lua: Move the taglist and tasklist button to the request:: section. While this is a bit more memory intensive because it created the objects per screen, it is more self contained. If the objective is to have well defined sections that can be cut/pasted into new files, this change is a net win. --- awesomerc.lua | 78 ++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/awesomerc.lua b/awesomerc.lua index e06910dd..a40e977b 100644 --- a/awesomerc.lua +++ b/awesomerc.lua @@ -102,49 +102,6 @@ mykeyboardlayout = awful.widget.keyboardlayout() -- Create a textclock widget mytextclock = wibox.widget.textclock() --- Create a wibox for each screen and add it --- @TAGLIST_BUTTON@ -local taglist_buttons = { - awful.button({ }, 1, function(t) t:view_only() end), - awful.button({ modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), - awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end), -} - --- @TASKLIST_BUTTON@ -local tasklist_buttons = { - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - c:emit_signal( - "request::activate", - "tasklist", - {raise = true} - ) - end - end), - awful.button({ }, 3, function() - awful.menu.client_list({ theme = { width = 250 } }) - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - end), -} - -- @DOC_WALLPAPER@ screen.connect_signal("request::wallpaper", function(s) -- Wallpaper @@ -165,6 +122,7 @@ screen.connect_signal("request::desktop_decoration", function(s) -- Create a promptbox for each screen s.mypromptbox = awful.widget.prompt() + -- Create an imagebox widget which will contain an icon indicating which layout we're using. -- We need one layoutbox per screen. s.mylayoutbox = awful.widget.layoutbox { @@ -181,14 +139,44 @@ screen.connect_signal("request::desktop_decoration", function(s) s.mytaglist = awful.widget.taglist { screen = s, filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons + buttons = { + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end), + } } -- Create a tasklist widget s.mytasklist = awful.widget.tasklist { screen = s, filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons + buttons = { + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + c:emit_signal( + "request::activate", + "tasklist", + {raise = true} + ) + end + end), + awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end), + awful.button({ }, 4, function() awful.client.focus.byidx( 1) end), + awful.button({ }, 5, function() awful.client.focus.byidx(-1) end), + } } -- @DOC_WIBAR@