Skip to content

Change no saved layouts when the workspaces cannot be read - #15267

Merged
dhh merged 1 commit into
quattrofrom
default-layout-query-guard
Oct 13, 2026
Merged

dhh merged 1 commit into
quattrofrom
default-layout-query-guard

Conversation

@dhh

@dhh dhh commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

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 -j or unreadable output erased every saved layout, those of workspaces with windows included. The command now checks both hyprctl and jq and stops without changing anything.

Testing

  • hyprland-floating-workspaces-test.sh feeds the command unreadable workspace output and checks the saved layouts and the default are untouched.
  • hyprland-workspace-layout-test.sh passes.

🤖 Generated with Claude Code

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>
@dhh
dhh merged commit ed92b07 into quattro Oct 13, 2026
1 check passed
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Adds error handling to workspace layout initialization.

Reject empty successful workspace responses before merging so saved layouts cannot still be erased.

Findings

  1. P1 Empty replies erase saved layouts ▶

Summary

The PR checks hyprctl and jq before changing saved layouts.

  • Changing the default stops when the workspace list cannot be read.

Reviews (1) · Last reviewed commit: "Change no saved layouts when the workspa..." · Reviewed by Greptile

Comment on lines +47 to +48
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

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