Repository navigation
Conversation
Hyprland can close the event socket of a live session, after which no event arrived again and all Hyprland state stayed frozen. Reconnect with backoff and refresh monitors, workspaces, toplevels and the active toplevel once connected, as events sent in between are lost. Toplevel refreshes now also drop toplevels missing from j/clients and move toplevels between workspace lists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
The Hyprland event socket was only connected once. When Hyprland closes it (seen after lock/unlock cycles in #989), no more events arrive and every Hyprland property stays frozen until the shell restarts.
The socket now reconnects (after 100ms, doubling up to 5s), and once connected again monitors, workspaces, toplevels and the active toplevel are requested again, since events sent while disconnected are lost.
Fixes #989
Details and descisions
The existing disconnect check never fired: a socket closed by the peer goes Connected -> Closing -> Unconnected, and
validwas already false when it reached Unconnected. That is why the logs in #989 showPeerClosedErrorbut never "Hyprland event socket disconnected." The disconnect is now noticed when leaving ConnectedState, and the retry starts once the socket is Unconnected.refreshToplevels()never removed anything, so windows closed while disconnected would stay forever. It now removes toplevels missing from j/clients, but only those that already existed when the request was sent, so one created by an event while the request is pending is not dropped. It also takes a toplevel out of its old workspace's list when j/clients puts it on another workspace, like movewindowv2 does.The active toplevel comes from j/activewindow, which is empty when nothing is focused.
Tested with a fake Hyprland (below) that closes the event socket 2s in, changes state while nobody is connected (workspace 1 fullscreen with window a1 -> workspace 2, a1 closed, b2 active), then sends
workspacev2>>3,3at 4.5s.Before, on 2b4501a, state stays at the moment of the drop and the later event never arrives:
After:
With the socket path missing for 3s after the drop it retries at 100/200/400/800/1600ms and recovers the same way once the path is back. clang-format is clean.
fake Hyprland and probe config
Run with
XDG_RUNTIME_DIR=$(mktemp -d) HYPRLAND_INSTANCE_SIGNATURE=fake QT_QPA_PLATFORM=offscreen QT_LOGGING_RULES=quickshell.hyprland.ipc.info=true, startfake_hyprland.py 2 4.5, thenquickshell -p shell.qml.Open concerns
Reconnecting only happens after a connection was established once; a failing first connect behaves as before.
Participation
Written with an AI agent; I accept the project may close it.