awesomerc: Use the new declarative syntax

This commit is contained in:
Emmanuel Lepage Vallee 2015-09-27 17:00:01 +02:00
parent 7842f92f08
commit 0e833fd5f4
1 changed files with 53 additions and 59 deletions

View File

@ -195,27 +195,24 @@ for s = 1, screen.count() do
-- Create the wibox -- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s }) mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Widgets that are aligned to the left -- Add widgets to the wibox
local left_layout = wibox.layout.fixed.horizontal() mywibox[s]:setup {
left_layout:add(mylauncher) layout = wibox.layout.align.horizontal,
left_layout:add(mytaglist[s]) { -- Left widgets
left_layout:add(mypromptbox[s]) layout = wibox.layout.fixed.horizontal,
mylauncher,
-- Widgets that are aligned to the right mytaglist[s],
local right_layout = wibox.layout.fixed.horizontal() mypromptbox[s],
right_layout:add(mykeyboardlayout) },
mytasklist[s], -- Middle widget
if s == 1 then right_layout:add(wibox.widget.systray()) end { -- Right widgets
right_layout:add(mytextclock) layout = wibox.layout.fixed.horizontal,
right_layout:add(mylayoutbox[s]) mykeyboardlayout,
s == 1 and wibox.widget.systray(),
-- Now bring it all together (with the tasklist in the middle) mytextclock,
local layout = wibox.layout.align.horizontal() mylayoutbox[s],
layout:set_left(left_layout) },
layout:set_middle(mytasklist[s]) }
layout:set_right(right_layout)
mywibox[s]:set_widget(layout)
end end
-- }}} -- }}}
@ -482,45 +479,42 @@ client.connect_signal("manage", function (c)
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
-- buttons for the titlebar -- buttons for the titlebar
local buttons = awful.util.table.join( local buttons = awful.util.table.join(
awful.button({ }, 1, function() awful.button({ }, 1, function()
client.focus = c client.focus = c
c:raise() c:raise()
awful.mouse.client.move(c) awful.mouse.client.move(c)
end), end),
awful.button({ }, 3, function() awful.button({ }, 3, function()
client.focus = c client.focus = c
c:raise() c:raise()
awful.mouse.client.resize(c) awful.mouse.client.resize(c)
end) end)
) )
-- Widgets that are aligned to the left awful.titlebar(c) : setup {
local left_layout = wibox.layout.fixed.horizontal() { -- Left
left_layout:add(awful.titlebar.widget.iconwidget(c)) awful.titlebar.widget.iconwidget(c),
left_layout:buttons(buttons) buttons = buttons,
layout = wibox.layout.fixed.horizontal
-- Widgets that are aligned to the right },
local right_layout = wibox.layout.fixed.horizontal() { -- Middle
right_layout:add(awful.titlebar.widget.floatingbutton(c)) { -- Title
right_layout:add(awful.titlebar.widget.maximizedbutton(c)) align = "center",
right_layout:add(awful.titlebar.widget.stickybutton(c)) widget = awful.titlebar.widget.titlewidget(c)
right_layout:add(awful.titlebar.widget.ontopbutton(c)) },
right_layout:add(awful.titlebar.widget.closebutton(c)) buttons = buttons,
layout = wibox.layout.flex.horizontal
-- The title goes in the middle },
local middle_layout = wibox.layout.flex.horizontal() { -- Right
local title = awful.titlebar.widget.titlewidget(c) awful.titlebar.widget.floatingbutton (c),
title:set_align("center") awful.titlebar.widget.maximizedbutton(c),
middle_layout:add(title) awful.titlebar.widget.stickybutton (c),
middle_layout:buttons(buttons) awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
-- Now bring it all together layout = wibox.layout.fixed.horizontal()
local layout = wibox.layout.align.horizontal() },
layout:set_left(left_layout) layout = wibox.layout.align.horizontal
layout:set_right(right_layout) }
layout:set_middle(middle_layout)
awful.titlebar(c):set_widget(layout)
end end
end) end)