Add `fixed-center` option

Resolves #957
pull/1364/head
ilkecan 2021-12-28 15:57:10 +03:00
parent 8ec321ddaf
commit 548bd2ab1a
2 changed files with 11 additions and 1 deletions

View File

@ -82,6 +82,12 @@ Also a minimal example configuration can be found on the at the bottom of this m
default: *true* ++
Option to request an exclusive zone from the compositor. Disable this to allow drawing application windows underneath or on top of the bar.
*fixed-center* ++
typeof: bool ++
default: *true*
Prefer fixed center position for the `modules-center` block. The center block will stay in the middle of the bar whenever possible. It can still be pushed around if other blocks need more space.
When false, the center block is centered in the space between the left and right block.
*passthrough* ++
typeof: bool ++
default: *false* ++

View File

@ -767,7 +767,11 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos, Gtk
auto waybar::Bar::setupWidgets() -> void {
window.add(box_);
box_.pack_start(left_, false, false);
box_.set_center_widget(center_);
if (config["fixed-center"].isBool() ? config["fixed-center"].asBool() : true) {
box_.set_center_widget(center_);
} else {
box_.pack_start(center_, true, false);
}
box_.pack_end(right_, false, false);
// Convert to button code for every module that is used.