1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-12-22 19:22:32 +00:00

Vertex: Properly center using expand = "none"

Previous behaviour would not center the text clock, also the textclock would get 'squashed' and time would not be visible if, for example, a long command is typed into the prompt or there are too many icons in the systray.

By setting the align.horizontal layout to "none", this guarantees textclock will be in the middle, and that any overflow of right/left widgets do not affect it. Much neater behaviour. Also allows removing arbitray calculation for constraints based on workarea width.
This commit is contained in:
Ng Oon-Ee 2017-09-27 17:33:52 +08:00 committed by GitHub
parent e4b2773ae0
commit 0871e219d1

View file

@ -426,23 +426,24 @@ function theme.at_screen_connect(s)
-- Create the wibox -- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s, height = 25, bg = gears.color.create_png_pattern(theme.panelbg) }) s.mywibox = awful.wibar({ position = "top", screen = s, height = 25, bg = gears.color.create_png_pattern(theme.panelbg) })
local wiboxlayout = wibox.layout.align.horizontal()
wiboxlayout.expand = "none"
-- Add widgets to the wibox -- Add widgets to the wibox
s.mywibox:setup { s.mywibox:setup {
layout = wibox.layout.align.horizontal, layout = wiboxlayout,
{ -- Left widgets { -- Left widgets
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
s.mypromptbox, s.mypromptbox,
tspace1, tspace1,
wibox.container.constraint(s.mytasklist, "exact", s.workarea.width/2.6), s.mytasklist,
}, },
{ -- Middle widgets { -- Middle widgets
layout = wibox.layout.flex.horizontal, layout = wibox.layout.fixed.horizontal,
space,
mytextclock, mytextclock,
}, },
{ -- Right widgets { -- Right widgets
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
wibox.container.constraint(wibox.widget { nil, nil, theme.mpd.widget, layout = wibox.layout.align.horizontal }, "exact", s.workarea.width/3), wibox.widget { nil, nil, theme.mpd.widget, layout = wibox.layout.align.horizontal },
rspace0, rspace0,
theme.weather.icon, theme.weather.icon,
theme.weather.widget, theme.weather.widget,