Merge pull request #2965 from jramrath/hyprland-window_no_title_from_special
hyprland/window: fix title not showing for windows in special workspaces
This commit is contained in:
@@ -108,21 +108,14 @@ auto Window::update() -> void {
|
|||||||
AAppIconLabel::update();
|
AAppIconLabel::update();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Window::getActiveWorkspace() -> Workspace {
|
auto Window::getActiveWorkspace() -> Workspace { return getActiveWorkspace(""); }
|
||||||
const auto workspace = IPC::inst().getSocket1JsonReply("activeworkspace");
|
|
||||||
|
|
||||||
if (workspace.isObject()) {
|
|
||||||
return Workspace::parse(workspace);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
auto Window::getActiveWorkspace(const std::string& monitorName) -> Workspace {
|
auto Window::getActiveWorkspace(const std::string& monitorName) -> Workspace {
|
||||||
const auto monitors = IPC::inst().getSocket1JsonReply("monitors");
|
const auto monitors = IPC::inst().getSocket1JsonReply("monitors");
|
||||||
if (monitors.isArray()) {
|
if (monitors.isArray()) {
|
||||||
auto monitor = std::ranges::find_if(
|
auto monitor = std::ranges::find_if(monitors, [&](const Json::Value& monitor) {
|
||||||
monitors, [&](const Json::Value& monitor) { return monitor["name"] == monitorName; });
|
return monitorName.empty() ? monitor["focused"].asBool() : monitor["name"] == monitorName;
|
||||||
|
});
|
||||||
if (monitor == std::end(monitors)) {
|
if (monitor == std::end(monitors)) {
|
||||||
spdlog::warn("Monitor not found: {}", monitorName);
|
spdlog::warn("Monitor not found: {}", monitorName);
|
||||||
return Workspace{
|
return Workspace{
|
||||||
@@ -132,7 +125,8 @@ auto Window::getActiveWorkspace(const std::string& monitorName) -> Workspace {
|
|||||||
.last_window_title = "",
|
.last_window_title = "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const int id = (*monitor)["activeWorkspace"]["id"].asInt();
|
const int special_id = (*monitor)["specialWorkspace"]["id"].asInt();
|
||||||
|
const int id = special_id != 0 ? special_id : (*monitor)["activeWorkspace"]["id"].asInt();
|
||||||
|
|
||||||
const auto workspaces = IPC::inst().getSocket1JsonReply("workspaces");
|
const auto workspaces = IPC::inst().getSocket1JsonReply("workspaces");
|
||||||
if (workspaces.isArray()) {
|
if (workspaces.isArray()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user