From 548bd2ab1a834466e9d95560fd6ce1d6a2a398ba Mon Sep 17 00:00:00 2001 From: ilkecan Date: Tue, 28 Dec 2021 15:57:10 +0300 Subject: [PATCH] Add `fixed-center` option Resolves #957 --- man/waybar.5.scd.in | 6 ++++++ src/bar.cpp | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/man/waybar.5.scd.in b/man/waybar.5.scd.in index c42f6eb8..249ca7e4 100644 --- a/man/waybar.5.scd.in +++ b/man/waybar.5.scd.in @@ -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* ++ diff --git a/src/bar.cpp b/src/bar.cpp index 133c29aa..9685c7a9 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -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.