Skip to content

Commit

Permalink
Add inner left box to hide the padded outer box
Browse files Browse the repository at this point in the history
Fixes: #78
  • Loading branch information
scorpion-26 committed Mar 17, 2024
1 parent cb160d8 commit 1cf8f82
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,18 +1241,24 @@ namespace Bar
endLeftWidgets = -1;
}

auto leftWithPadding = Widget::Create<Box>();
leftWithPadding->SetSpacing({6, false});
leftWithPadding->SetClass("left-with-padding");
leftWithPadding->SetOrientation(Utils::GetOrientation());
// For centerTime the width of the left widget handles the centering.
// For not centerTime we want to set it as much right as possible. So let this expand as much as possible.
Utils::SetTransform(*leftWithPadding, {endLeftWidgets, !Config::Get().centerWidgets, Alignment::Left, 12, 0});

auto left = Widget::Create<Box>();
left->SetSpacing({6, false});
left->SetClass("left");
left->SetOrientation(Utils::GetOrientation());
// For centerTime the width of the left widget handles the centering.
// For not centerTime we want to set it as much right as possible. So let this expand as much as possible.
Utils::SetTransform(*left, {endLeftWidgets, !Config::Get().centerWidgets, Alignment::Left, 12, 0});
Utils::SetTransform(*left, {-1, false, Alignment::Left});

for (auto& widget : Config::Get().widgetsLeft)
{
ChooseWidgetToDraw(widget, *left, Side::Left);
}
leftWithPadding->AddChild(std::move(left));

auto center = Widget::Create<Box>();
center->SetClass("center");
Expand All @@ -1276,7 +1282,7 @@ namespace Bar
ChooseWidgetToDraw(widget, *right, Side::Right);
}

mainWidget->AddChild(std::move(left));
mainWidget->AddChild(std::move(leftWithPadding));
mainWidget->AddChild(std::move(center));
mainWidget->AddChild(std::move(right));
}
Expand Down

0 comments on commit 1cf8f82

Please sign in to comment.