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.
This commit is contained in:
Emmanuel Lepage Vallee 2019-10-16 03:04:37 -04:00
parent ba1d5bf712
commit 5713a19602
1 changed files with 33 additions and 45 deletions

View File

@ -102,49 +102,6 @@ mykeyboardlayout = awful.widget.keyboardlayout()
-- Create a textclock widget -- Create a textclock widget
mytextclock = wibox.widget.textclock() 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@ -- @DOC_WALLPAPER@
screen.connect_signal("request::wallpaper", function(s) screen.connect_signal("request::wallpaper", function(s)
-- Wallpaper -- Wallpaper
@ -165,6 +122,7 @@ screen.connect_signal("request::desktop_decoration", function(s)
-- Create a promptbox for each screen -- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt() s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using. -- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen. -- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox { s.mylayoutbox = awful.widget.layoutbox {
@ -181,14 +139,44 @@ screen.connect_signal("request::desktop_decoration", function(s)
s.mytaglist = awful.widget.taglist { s.mytaglist = awful.widget.taglist {
screen = s, screen = s,
filter = awful.widget.taglist.filter.all, 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 -- Create a tasklist widget
s.mytasklist = awful.widget.tasklist { s.mytasklist = awful.widget.tasklist {
screen = s, screen = s,
filter = awful.widget.tasklist.filter.currenttags, 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@ -- @DOC_WIBAR@