hyprland/window: rename .hidden to .swallowing (and fix grouped windows)
parent
14c6550593
commit
daca57129f
|
@ -31,6 +31,8 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
|
|||
std::string initial_class_name;
|
||||
std::string title;
|
||||
std::string initial_title;
|
||||
bool fullscreen;
|
||||
bool grouped;
|
||||
|
||||
static auto parse(const Json::Value&) -> WindowData;
|
||||
};
|
||||
|
@ -51,7 +53,7 @@ class Window : public waybar::AAppIconLabel, public EventHandler {
|
|||
std::string last_solo_class_;
|
||||
bool solo_;
|
||||
bool all_floating_;
|
||||
bool hidden_;
|
||||
bool swallowing_;
|
||||
bool fullscreen_;
|
||||
};
|
||||
|
||||
|
|
|
@ -76,5 +76,4 @@ window widget:
|
|||
- *window#waybar.floating* When there are only floating windows in the workspace
|
||||
- *window#waybar.fullscreen* When there is a fullscreen window in the workspace;
|
||||
useful with Hyprland's *fullscreen, 1* mode
|
||||
- *window#waybar.hidden-window* When there are hidden windows in the workspace;
|
||||
can occur due to window swallowing, *fullscreen, 1* mode, or grouped windows
|
||||
- *window#waybar.swallowing* When there is a swallowed window in the workspace
|
||||
|
|
|
@ -72,7 +72,7 @@ auto Window::update() -> void {
|
|||
setClass("empty", workspace_.windows == 0);
|
||||
setClass("solo", solo_);
|
||||
setClass("floating", all_floating_);
|
||||
setClass("hidden-window", hidden_);
|
||||
setClass("swallowing", swallowing_);
|
||||
setClass("fullscreen", fullscreen_);
|
||||
|
||||
if (!last_solo_class_.empty() && solo_class_ != last_solo_class_) {
|
||||
|
@ -125,9 +125,10 @@ auto Window::Workspace::parse(const Json::Value& value) -> Window::Workspace {
|
|||
}
|
||||
|
||||
auto Window::WindowData::parse(const Json::Value& value) -> Window::WindowData {
|
||||
return WindowData{value["floating"].asBool(), value["monitor"].asInt(),
|
||||
value["class"].asString(), value["initialClass"].asString(),
|
||||
value["title"].asString(), value["initialTitle"].asString()};
|
||||
return WindowData{value["floating"].asBool(), value["monitor"].asInt(),
|
||||
value["class"].asString(), value["initialClass"].asString(),
|
||||
value["title"].asString(), value["initialTitle"].asString(),
|
||||
value["fullscreen"].asBool(), !value["grouped"].empty()};
|
||||
}
|
||||
|
||||
void Window::queryActiveWorkspace() {
|
||||
|
@ -156,8 +157,8 @@ void Window::queryActiveWorkspace() {
|
|||
[&](Json::Value window) {
|
||||
return window["workspace"]["id"] == workspace_.id && window["mapped"].asBool();
|
||||
});
|
||||
hidden_ = std::any_of(workspace_windows.begin(), workspace_windows.end(),
|
||||
[&](Json::Value window) { return window["hidden"].asBool(); });
|
||||
swallowing_ = std::any_of(workspace_windows.begin(), workspace_windows.end(),
|
||||
[&](Json::Value window) { return !window["swallowing"].isNull(); });
|
||||
std::vector<Json::Value> visible_windows;
|
||||
std::copy_if(workspace_windows.begin(), workspace_windows.end(),
|
||||
std::back_inserter(visible_windows),
|
||||
|
@ -166,12 +167,19 @@ void Window::queryActiveWorkspace() {
|
|||
[&](Json::Value window) { return !window["floating"].asBool(); });
|
||||
all_floating_ = std::all_of(visible_windows.begin(), visible_windows.end(),
|
||||
[&](Json::Value window) { return window["floating"].asBool(); });
|
||||
fullscreen_ = (*active_window)["fullscreen"].asBool();
|
||||
fullscreen_ = window_data_.fullscreen;
|
||||
|
||||
// Fullscreen windows look like they are solo
|
||||
if (fullscreen_) {
|
||||
solo_ = true;
|
||||
}
|
||||
|
||||
// Grouped windows have a tab bar and therefore don't look fullscreen or solo
|
||||
if (window_data_.grouped) {
|
||||
fullscreen_ = false;
|
||||
solo_ = false;
|
||||
}
|
||||
|
||||
if (solo_) {
|
||||
solo_class_ = window_data_.class_name;
|
||||
} else {
|
||||
|
@ -180,7 +188,7 @@ void Window::queryActiveWorkspace() {
|
|||
} else {
|
||||
window_data_ = WindowData{};
|
||||
all_floating_ = false;
|
||||
hidden_ = false;
|
||||
swallowing_ = false;
|
||||
fullscreen_ = false;
|
||||
solo_ = false;
|
||||
solo_class_ = "";
|
||||
|
|
Loading…
Reference in New Issue