Skip to content

fix(hyprland): sort toplevels by x/y coordinates to fix workspace widget ordering in dynamic layouts#2094

Merged
Ly-sec merged 1 commit intonoctalia-dev:mainfrom
rivera-diego:main
Mar 11, 2026
Merged

fix(hyprland): sort toplevels by x/y coordinates to fix workspace widget ordering in dynamic layouts#2094
Ly-sec merged 1 commit intonoctalia-dev:mainfrom
rivera-diego:main

Conversation

@rivera-diego
Copy link
Copy Markdown
Contributor

Bug In Hyprland, when using dynamic tiling layouts that aren't purely chronological (like Master Layout or the new Scrolling Layout), the Workspaces widget displays the application icons out of order compared to their physical placement on the screen. This happens because Hyprland.toplevels.values returns the windows in an unstructured order, usually chronologically based on focus history.

Fix This PR modifies

HyprlandService.qml
to:

Safely extract the geometric x and y coordinates directly from the raw IPC data (lastIpcObject.at), falling back to standard variables.
Introduce a toSortedWindowList manual fallback mapping function right before the return iteration.
Sort the matrix based on Spatial representation: workspace first, then X coordinates (left to right), then Y coordinates (top to bottom).
The new automatic parsing in v4.6.0 handles the raw events gorgeously, but chaining it with this geometric sorting creates a bullet-proof, 1:1 screen representation on the Workspaces widget.

@Ly-sec
Copy link
Copy Markdown
Collaborator

Ly-sec commented Mar 11, 2026

Hey @rivera-diego , I just tested it and it's seemingly working fine. Thank you very much!

@Ly-sec Ly-sec merged commit cc9bf7d into noctalia-dev:main Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants