Merge pull request #4437 from jp7677/ext-workspaces-remove-dirty-tracking
ext/workspaces: fix appearing of hidden workspaces
This commit is contained in:
@ -136,8 +136,6 @@ class Workspace {
|
|||||||
Gtk::Button button_;
|
Gtk::Button button_;
|
||||||
Gtk::Box content_;
|
Gtk::Box content_;
|
||||||
Gtk::Label label_;
|
Gtk::Label label_;
|
||||||
|
|
||||||
bool needs_updating_ = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace waybar::modules::ext
|
} // namespace waybar::modules::ext
|
||||||
|
@ -64,6 +64,8 @@ Addressed by *ext/workspaces*
|
|||||||
|
|
||||||
*activate*: Switch to workspace.
|
*activate*: Switch to workspace.
|
||||||
|
|
||||||
|
*deactivate*: Deactivate the workspace.
|
||||||
|
|
||||||
*close*: Close the workspace.
|
*close*: Close the workspace.
|
||||||
|
|
||||||
# ICONS
|
# ICONS
|
||||||
|
@ -377,16 +377,19 @@ Workspace::~Workspace() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::update() {
|
void Workspace::update() {
|
||||||
if (!needs_updating_) {
|
const auto style_context = button_.get_style_context();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update style and visibility
|
// update style and visibility
|
||||||
|
|
||||||
const auto style_context = button_.get_style_context();
|
if (!has_state(EXT_WORKSPACE_HANDLE_V1_STATE_ACTIVE)) {
|
||||||
style_context->remove_class("active");
|
style_context->remove_class("active");
|
||||||
style_context->remove_class("urgent");
|
}
|
||||||
style_context->remove_class("hidden");
|
if (!has_state(EXT_WORKSPACE_HANDLE_V1_STATE_URGENT)) {
|
||||||
|
style_context->remove_class("urgent");
|
||||||
|
}
|
||||||
|
if (!has_state(EXT_WORKSPACE_HANDLE_V1_STATE_HIDDEN)) {
|
||||||
|
style_context->remove_class("hidden");
|
||||||
|
}
|
||||||
|
|
||||||
if (has_state(EXT_WORKSPACE_HANDLE_V1_STATE_ACTIVE)) {
|
if (has_state(EXT_WORKSPACE_HANDLE_V1_STATE_ACTIVE)) {
|
||||||
button_.set_visible(true);
|
button_.set_visible(true);
|
||||||
@ -408,34 +411,26 @@ void Workspace::update() {
|
|||||||
label_.set_markup(fmt::format(fmt::runtime(format_), fmt::arg("name", name_),
|
label_.set_markup(fmt::format(fmt::runtime(format_), fmt::arg("name", name_),
|
||||||
fmt::arg("id", workspace_id_),
|
fmt::arg("id", workspace_id_),
|
||||||
fmt::arg("icon", with_icon_ ? icon() : "")));
|
fmt::arg("icon", with_icon_ ? icon() : "")));
|
||||||
|
|
||||||
needs_updating_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::handle_id(const std::string &id) {
|
void Workspace::handle_id(const std::string &id) {
|
||||||
spdlog::debug("[ext/workspaces]: ID for workspace {}: {}", id_, id);
|
spdlog::debug("[ext/workspaces]: ID for workspace {}: {}", id_, id);
|
||||||
workspace_id_ = id;
|
workspace_id_ = id;
|
||||||
needs_updating_ = true;
|
|
||||||
workspace_manager_.set_needs_sorting();
|
workspace_manager_.set_needs_sorting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::handle_name(const std::string &name) {
|
void Workspace::handle_name(const std::string &name) {
|
||||||
spdlog::debug("[ext/workspaces]: Name for workspace {}: {}", id_, name);
|
spdlog::debug("[ext/workspaces]: Name for workspace {}: {}", id_, name);
|
||||||
name_ = name;
|
name_ = name;
|
||||||
needs_updating_ = true;
|
|
||||||
workspace_manager_.set_needs_sorting();
|
workspace_manager_.set_needs_sorting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::handle_coordinates(const std::vector<uint32_t> &coordinates) {
|
void Workspace::handle_coordinates(const std::vector<uint32_t> &coordinates) {
|
||||||
coordinates_ = coordinates;
|
coordinates_ = coordinates;
|
||||||
needs_updating_ = true;
|
|
||||||
workspace_manager_.set_needs_sorting();
|
workspace_manager_.set_needs_sorting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::handle_state(uint32_t state) {
|
void Workspace::handle_state(uint32_t state) { state_ = state; }
|
||||||
state_ = state;
|
|
||||||
needs_updating_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::handle_capabilities(uint32_t capabilities) {
|
void Workspace::handle_capabilities(uint32_t capabilities) {
|
||||||
spdlog::debug("[ext/workspaces]: Capabilities for workspace {}:", id_);
|
spdlog::debug("[ext/workspaces]: Capabilities for workspace {}:", id_);
|
||||||
@ -451,7 +446,6 @@ void Workspace::handle_capabilities(uint32_t capabilities) {
|
|||||||
if ((capabilities & EXT_WORKSPACE_HANDLE_V1_WORKSPACE_CAPABILITIES_ASSIGN) == capabilities) {
|
if ((capabilities & EXT_WORKSPACE_HANDLE_V1_WORKSPACE_CAPABILITIES_ASSIGN) == capabilities) {
|
||||||
spdlog::debug("[ext/workspaces]: - assign");
|
spdlog::debug("[ext/workspaces]: - assign");
|
||||||
}
|
}
|
||||||
needs_updating_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::handle_removed() {
|
void Workspace::handle_removed() {
|
||||||
@ -475,6 +469,8 @@ bool Workspace::handle_clicked(const GdkEventButton *button) const {
|
|||||||
|
|
||||||
if (action == "activate") {
|
if (action == "activate") {
|
||||||
ext_workspace_handle_v1_activate(ext_handle_);
|
ext_workspace_handle_v1_activate(ext_handle_);
|
||||||
|
} else if (action == "deactivate") {
|
||||||
|
ext_workspace_handle_v1_deactivate(ext_handle_);
|
||||||
} else if (action == "close") {
|
} else if (action == "close") {
|
||||||
ext_workspace_handle_v1_remove(ext_handle_);
|
ext_workspace_handle_v1_remove(ext_handle_);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user