feat(bar): add config flag to disable exclusive zone

pull/1113/head
Aleksei Bavshin 2021-01-17 01:40:25 -08:00
parent 729553d3bc
commit 7aaa3df701
No known key found for this signature in database
GPG Key ID: 4F071603387A382A
2 changed files with 10 additions and 2 deletions

View File

@ -65,6 +65,7 @@ class Bar {
struct waybar_output *output; struct waybar_output *output;
Json::Value config; Json::Value config;
struct wl_surface * surface; struct wl_surface * surface;
bool exclusive = true;
bool visible = true; bool visible = true;
bool vertical = false; bool vertical = false;
Gtk::Window window; Gtk::Window window;

View File

@ -409,6 +409,13 @@ waybar::Bar::Bar(struct waybar_output* w_output, const Json::Value& w_config)
layer_ = bar_layer::OVERLAY; layer_ = bar_layer::OVERLAY;
} }
if (config["exclusive"].isBool()) {
exclusive = config["exclusive"].asBool();
} else if (layer_ == bar_layer::OVERLAY) {
// swaybar defaults: overlay mode does not reserve an exclusive zone
exclusive = false;
}
bool passthrough = false; bool passthrough = false;
if (config["passthrough"].isBool()) { if (config["passthrough"].isBool()) {
passthrough = config["passthrough"].asBool(); passthrough = config["passthrough"].asBool();
@ -492,7 +499,7 @@ waybar::Bar::Bar(struct waybar_output* w_output, const Json::Value& w_config)
} }
surface_impl_->setLayer(layer_); surface_impl_->setLayer(layer_);
surface_impl_->setExclusiveZone(true); surface_impl_->setExclusiveZone(exclusive);
surface_impl_->setMargins(margins_); surface_impl_->setMargins(margins_);
surface_impl_->setPassThrough(passthrough); surface_impl_->setPassThrough(passthrough);
surface_impl_->setPosition(position); surface_impl_->setPosition(position);
@ -533,7 +540,7 @@ void waybar::Bar::setVisible(bool value) {
window.set_opacity(1); window.set_opacity(1);
surface_impl_->setLayer(layer_); surface_impl_->setLayer(layer_);
} }
surface_impl_->setExclusiveZone(visible); surface_impl_->setExclusiveZone(exclusive && visible);
surface_impl_->commit(); surface_impl_->commit();
} }