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