feat(glazewm): Add global workspace focus highlighting and persistent workspaces#679
feat(glazewm): Add global workspace focus highlighting and persistent workspaces#679Louis047 wants to merge 4 commits intoamnweb:mainfrom
Conversation
ed73273 to
50e5f54
Compare
… workspaces - Add is_focused_workspace field to Workspace dataclass - Read isFocusedWorkspace from GlazeWM IPC for global focus - Implement persistent_workspaces with count-based format - Cache display_names from GlazeWM config at startup - Simplify status logic to FOCUSED/POPULATED/EMPTY states - Apply global focus highlighting across all monitor bars Requires: glzr-io/glazewm#1264
50e5f54 to
0c15ea1
Compare
GlazeWM's hasFocus field is already globally unique - only ONE workspace across all monitors can have hasFocus: true. Removed redundant is_focused_workspace field and updated all usages to use the existing focus field. Changes: - Removed is_focused_workspace from Workspace dataclass - Replaced workspace.is_focused_workspace with workspace.focus
|
Update on the Dependencies part: I have raised this issue with the glazewm dev and he confirmed that the dependency PR linked above isn't necessary and as a solution utilizing |
Video-Nomad
left a comment
There was a problem hiding this comment.
Can you please explain in detail how those persistent workspaces should work and how it compares to just setting every workspace in GlazeWM as keep_alive: true? You can already set custom names there, bind them to monitors, keep them alive even when they are empty, etc. It's all in GlazeWM config, YASB just uses that information.
I still can't grasp the goal of this persistent workspaces change.
Focused and active workspaces are already customizable as mentioned in the code comments. Just set:
.glazewm-workspaces .ws-btn.active_populated,
.glazewm-workspaces .ws-btn.active_empty {
background: transparent;
}| # Only the globally focused workspace gets FOCUSED status (highlighted) | ||
| # Other workspaces just show as POPULATED or EMPTY - no ACTIVE highlighting | ||
| # This matches Waybar-style behavior: only truly focused workspace is highlighted | ||
| if self.is_focused: |
There was a problem hiding this comment.
This change completely overrides #550
If the goal was to have no highlighting on an active (but unfocused) workspace there's always an option to change .ws-btn.active_populated and .ws-btn.active_empty to something like background: transparent.
No need to destroy the existing functionality completely.
There was a problem hiding this comment.
I have provided a good explanation for this, and I think it might answer your queries on this line of code 👍
| # Only the globally focused workspace gets FOCUSED status (highlighted) | ||
| # Other workspaces just show as POPULATED or EMPTY - no ACTIVE highlighting | ||
| # This matches Waybar-style behavior: only truly focused workspace is highlighted | ||
| if self.is_focused: |
| _config_loaded: bool = False | ||
|
|
||
| @classmethod | ||
| def _load_glazewm_config(cls) -> None: |
There was a problem hiding this comment.
This is extremely brittle approach. GlazeWM already provides enough data via IPC connection.
|
my apologies for not detailing much about the PR and what it exactly addresses, I'll post the explanation and will look into the code review in detail once I get back home The main purpose of this PR is to replicate the same behavior of persistent workspaces from hyprland with waybar module. |
|
I have checked your comments on the code review and I'm working on it now 👍 |
|
So the bottom line is:
So the solutions here are:
# Focus workspaces skipping empty ones
- commands: ["focus --next-populated-workspace"]
bindings: ["alt+d"]
- commands: ["focus --prev-populated-workspace"]
bindings: ["alt+a"] |
|
I shall propose an idea based on your views:
I feel that this would make it more modular and the said features optional for users to utilize it without compromising their default YASB config. Let me know of your thoughts on this. This would allow users who love using I'm ready to refactor the current PR with a better approach with your approval 👍 |


GlazeWM Workspaces: Global Focus Highlighting & Persistent Workspaces
Summary
This PR adds global workspace focus highlighting and persistent workspaces support to the GlazeWM Workspaces widget, bringing feature parity with Waybar-style workspace indicators.
Problem
Previously, YASB's GlazeWM widget only highlighted the "focused" workspace per-monitor
using. In multi-monitor setups, this meant:hasFocusUsers expected the truly focused workspace (the one with keyboard focus) to be highlighted on ALL monitor bars simultaneously.
Solution
1. Global Focus Highlighting
(Requires GlazeWM PR)This PR
integrates with a newutilizesisFocusedWorkspacefieldhasFocusexposed by GlazeWM's IPC. This field indicates the globally focused workspace across all monitors.Changes:
client.py:AddedUsesis_focused_workspacefield toWorkspacedataclass, reading fromisFocusedWorkspacehasFocusnow for checking global focused workspaceworkspaces.py:UsesUtilizesis_focused_workspaceinstead ofhasFocusfor button highlightinghasFocusto highlight the correct globally focused workspace across monitors2. Persistent Workspaces
Added Waybar-style persistent workspaces support with two formats:
Count-based (recommended):
Display name mapping:
The above will be parsed directly from GlazeWM and assigning a new
display_nameinpersistent_workspacesis invalid. Count-based is the recommended option.Features:
display_namefrom GlazeWM config at startup3. Simplified Status Logic
Updated
_update_status()to match Waybar behavior:Removed intermediate
ACTIVE_*states for cleaner styling when using global focus.Files Changed
src/core/utils/widgets/glazewm/client.pyAddedUsesis_focused_workspacefieldhasFocusfor global focused workspacessrc/core/widgets/glazewm/workspaces.pysrc/core/validation/widgets/glazewm/workspaces.pypersistent_workspacesschemadocs/widgets/(Widget)-GlazeWM-Workspaces.mdConfiguration
Dependencies
This PR requires a corresponding change in GlazeWM to expose theisFocusedWorkspacefield via IPC.GlazeWM PR: glzr-io/glazewm#1264The linked PR isn't necessary
Testing
withisFocusedWorkspacesupport