perf(sway/workspaces): avoid full tree for simple configs#3
Conversation
66dda49 to
76112b5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76112b59c1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (node.isMember("nodes") || node.isMember("floating_nodes")) { | ||
| return node["nodes"].empty() && node["floating_nodes"].empty(); | ||
| } | ||
| return node["target_output"].isString(); |
There was a problem hiding this comment.
Preserve empty workspace detection on the fast path
When window-rewrite is not configured, the new IPC_GET_WORKSPACES path feeds real workspaces that do not contain nodes/floating_nodes; they also do not have target_output, so this fallback returns false for every real workspace. As a result, an actually empty Sway workspace no longer receives #workspaces button.empty unless the user enables window-rewrite and forces the tree path, breaking the documented empty styling for the common/simple config this optimization targets.
Useful? React with 👍 / 👎.
Summary
IPC_GET_WORKSPACESwhensway/workspacesdoes not need per-window tree data.IPC_GET_TREEpath forwindow-rewrite, where child window nodes are required.Why
Simple workspace configs only need Sway's workspace list, but Waybar was fetching and parsing the full tree on every workspace/window event. The smaller IPC reply reduces JSON parse and allocation work while preserving the tree-backed path for configs that need it.
Testing
ninja -C buildmeson test -C build