Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
- Fixed session lock crashes on sleep, wake, DPMS, and unlocking.
- QsWindow.updatesEnabled makes sure windows are redrawn when set to true.
- Fixed potential crashes from usage of `WindowsetProjection.screens` during monitor unplug.
- Fixed Hyprland.activeToplevel being null until the user changes focus, by seeding it from j/clients during init.
12 changes: 12 additions & 0 deletions src/wayland/hyprland/ipc/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ void HyprlandIpc::refreshToplevels() {
auto json = QJsonDocument::fromJson(resp).array();

const auto& mList = this->mToplevels.valueList();
HyprlandToplevel* focusedToplevel = nullptr;

for (auto entry: json) {
auto object = entry.toObject().toVariantMap();
Expand Down Expand Up @@ -742,6 +743,17 @@ void HyprlandIpc::refreshToplevels() {

auto* workspace = toplevel->bindableWorkspace().value();
if (workspace) workspace->insertToplevel(toplevel);

// focusHistoryID == 0 marks the currently focused window. Hyprland's
// event socket only emits activewindowv2 on focus changes, so without
// this seed activeToplevel stays null until the user switches focus.
if (object.value("focusHistoryID").toInt() == 0) {
focusedToplevel = toplevel;
}
}

if (focusedToplevel && this->bActiveToplevel.value() == nullptr) {
this->bActiveToplevel = focusedToplevel;
}
});
}
Expand Down
Loading