Repository navigation
Change no saved layouts when the workspaces cannot be read - #15267
Conversation
Without the workspace list, every workspace looked empty, so a failed hyprctl or unreadable output erased every saved layout, those of workspaces with windows included. The default command now stops and changes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| if ! workspaces=$(hyprctl workspaces -j) || | ||
| ! busy=$(jq -r 'if type == "array" then .[] | select(.id >= 1 and (.windows // 0) > 0) | .id else error("not a workspace list") end' <<<"$workspaces"); then |
There was a problem hiding this comment.
Empty replies erase saved layouts
If hyprctl workspaces -j succeeds but returns empty or whitespace-only output, jq exits successfully without running the type check. That leaves busy empty, so the command deletes every saved workspace layout and overwrites default.lua, including layouts for workspaces with open windows.
Reject responses containing no JSON value before changing files, while still accepting []. Add an empty-output regression case alongside the malformed-JSON test.
Follow-up to #15266, from its review.
Changing the default layout resets every workspace without windows. Without the workspace list, every workspace looked empty, so a failed
hyprctl workspaces -jor unreadable output erased every saved layout, those of workspaces with windows included. The command now checks bothhyprctlandjqand stops without changing anything.Testing
hyprland-floating-workspaces-test.shfeeds the command unreadable workspace output and checks the saved layouts and the default are untouched.hyprland-workspace-layout-test.shpasses.🤖 Generated with Claude Code