Merge pull request #2153 from MonstrousOgre/master

This commit is contained in:
Alex 2023-05-04 22:21:13 +02:00 committed by GitHub
commit 56fa6b6afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,7 @@ class Workspace {
auto is_active() const -> bool { return state_ & static_cast<uint32_t>(State::ACTIVE); } auto is_active() const -> bool { return state_ & static_cast<uint32_t>(State::ACTIVE); }
auto is_urgent() const -> bool { return state_ & static_cast<uint32_t>(State::URGENT); } auto is_urgent() const -> bool { return state_ & static_cast<uint32_t>(State::URGENT); }
auto is_hidden() const -> bool { return state_ & static_cast<uint32_t>(State::HIDDEN); } auto is_hidden() const -> bool { return state_ & static_cast<uint32_t>(State::HIDDEN); }
auto is_empty() const -> bool { return state_ & static_cast<uint32_t>(State::EMPTY); }
auto is_persistent() const -> bool { return persistent_; } auto is_persistent() const -> bool { return persistent_; }
// wlr stuff // wlr stuff
auto handle_name(const std::string &name) -> void; auto handle_name(const std::string &name) -> void;
@ -51,6 +52,7 @@ class Workspace {
ACTIVE = (1 << 0), ACTIVE = (1 << 0),
URGENT = (1 << 1), URGENT = (1 << 1),
HIDDEN = (1 << 2), HIDDEN = (1 << 2),
EMPTY = (1 << 3),
}; };
private: private:

View File

@ -374,6 +374,8 @@ Workspace::Workspace(const Bar &bar, const Json::Value &config, WorkspaceGroup &
name_(name) { name_(name) {
if (workspace) { if (workspace) {
add_workspace_listener(workspace, this); add_workspace_listener(workspace, this);
} else {
state_ = (uint32_t)State::EMPTY;
} }
auto config_format = config["format"]; auto config_format = config["format"];
@ -447,6 +449,8 @@ auto Workspace::handle_remove() -> void {
} }
if (!persistent_) { if (!persistent_) {
workspace_group_.remove_workspace(id_); workspace_group_.remove_workspace(id_);
} else {
state_ = (uint32_t)State::EMPTY;
} }
} }
@ -465,6 +469,7 @@ auto Workspace::handle_done() -> void {
add_or_remove_class(style_context, is_active(), "active"); add_or_remove_class(style_context, is_active(), "active");
add_or_remove_class(style_context, is_urgent(), "urgent"); add_or_remove_class(style_context, is_urgent(), "urgent");
add_or_remove_class(style_context, is_hidden(), "hidden"); add_or_remove_class(style_context, is_hidden(), "hidden");
add_or_remove_class(style_context, is_empty(), "persistent");
if (workspace_group_.creation_delayed()) { if (workspace_group_.creation_delayed()) {
return; return;