Skip to content

Commit

Permalink
Replaced enable-/removeExclusiveZone by setExclusive.
Browse files Browse the repository at this point in the history
  • Loading branch information
emirror-de committed Sep 14, 2021
1 parent 0aecb78 commit 6c3b7e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions include/bar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class Bar {

void setVisible(bool visible);
void toggle();
auto removeExclusiveZone() const -> void;
auto enableExclusiveZone() const -> void;
void setExclusive(bool value);
void handleSignal(int);

struct waybar_output *output;
Expand Down
8 changes: 4 additions & 4 deletions src/bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,12 @@ void waybar::Bar::setVisible(bool value) {
surface_impl_->commit();
}

auto waybar::Bar::removeExclusiveZone() const -> void {
surface_impl_->setExclusiveZone(false);
}

auto waybar::Bar::enableExclusiveZone() const -> void {
surface_impl_->setExclusiveZone(true);
void waybar::Bar::setExclusive(bool value) {
exclusive = value;
surface_impl_->setExclusiveZone(exclusive && visible);
surface_impl_->commit();
}

void waybar::Bar::toggle() {
Expand Down
9 changes: 3 additions & 6 deletions src/modules/sway/hide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Hide::Hide(const std::string& id, const Bar& bar, const Json::Value& config)
: ALabel(config, "hide", id, "{}", 0, true), bar_(bar), windowId_(-1) {
ipc_.subscribe(R"(["bar_state_update","barconfig_update"])");
ipc_.signal_event.connect(sigc::mem_fun(*this, &Hide::onEvent));
// Do not reserve space for the bar anymore
bar.removeExclusiveZone();
// Launch worker
worker();
}
Expand All @@ -19,20 +17,19 @@ void Hide::onEvent(const struct Ipc::ipc_response& res) {
auto payload = parser_.parse(res.payload);
std::lock_guard<std::mutex> lock(mutex_);
if (payload.isMember("mode")) {
// barconfig_update: get mode
auto mode = payload["mode"].asString();
if (mode == "hide") {
// Hide the bars when configuring the "hide" bar
spdlog::info("sway/hide: hiding bar(s)");
spdlog::debug("sway/hide: hiding bar(s)");
for (auto& bar : waybar::Client::inst()->bars) {
bar->setVisible(false);
bar->removeExclusiveZone();
bar->setExclusive(false);
}
} else if (mode == "dock") {
spdlog::info("sway/hide: showing bar(s)");
for (auto& bar : waybar::Client::inst()->bars) {
bar->setVisible(true);
bar->enableExclusiveZone();
bar->setExclusive(true);
}
}
} else if (payload.isMember("visible_by_modifier")) {
Expand Down

0 comments on commit 6c3b7e4

Please sign in to comment.