feat(glazewm): add monitor_exclusive IPC mode and deprecate hide_empty_workspaces#718
Conversation
94cad29 to
97568b1
Compare
There was a problem hiding this comment.
Thanks for the PR! Nice addition👍
Checked the functionality and it seems to be working as expected.
- Checked
monitor_exclusive: falsein both icon and no icon mode. - Checked GlazeWM
keep_alive: trueon workspaces. - Checked the new option with GlazeWM
nameanddisplay_name. - Styles seems to be working fine.
Without any changes my default config looks exactly the same.
Other than proposed changes in the comments I think this is good to go.
| @@ -85,20 +80,31 @@ def _activate_workspace(self): | |||
| self.glazewm_client.activate_workspace(self.workspace_name) | |||
|
|
|||
| def _update_status(self): | |||
There was a problem hiding this comment.
This arrow of death is out of control at this point😅
I think something like this might be better:
def _update_status(self):
is_populated = self.workspace_window_count > 0
# 1. Highest Priority: Focused
if self.is_focused:
self.status = WorkspaceStatus.FOCUSED_POPULATED if is_populated else WorkspaceStatus.FOCUSED_EMPTY
# 2. Second Priority: Active (Exclusive + Displayed)
elif self.monitor_exclusive and self.is_displayed:
self.status = WorkspaceStatus.ACTIVE_POPULATED if is_populated else WorkspaceStatus.ACTIVE_EMPTY
# 3. Fallback: Default status
else:
self.status = WorkspaceStatus.POPULATED if is_populated else WorkspaceStatus.EMPTY| @@ -255,20 +260,31 @@ def _activate_workspace(self): | |||
| self.glazewm_client.activate_workspace(self.workspace_name) | |||
|
|
|||
| def _update_status(self): | |||
There was a problem hiding this comment.
Same pattern as in the previous comment
schema.json
Outdated
| "title": "Hide If Offline", | ||
| "type": "boolean" | ||
| }, | ||
| "monitor_exclusive": { |
There was a problem hiding this comment.
Schema is auto-generated. No need to add anything manually.
| options: | ||
| offline_label: "GlazeWM Offline" | ||
| hide_empty_workspaces: true | ||
| hide_empty_workspaces: true # deprecated (ignored) |
There was a problem hiding this comment.
This can be removed from the docs
| | `focused_populated_label`| string | `'{name}'` | Optional label for the currently focused workspace (has opened windows). Falls back to `active_populated_label` if not set. | | ||
| | `focused_empty_label` | string | `'{name}'` | Optional label for the currently focused workspace (has no windows opened). Falls back to `active_empty_label` if not set. | | ||
| | `hide_empty_workspaces` | boolean | `true` | Whether to hide empty workspaces. | | ||
| | `hide_empty_workspaces` | boolean | `true` | Deprecated. Kept for backward compatibility; visibility is controlled by GlazeWM (`keep_alive`) and monitor data from IPC. | |
There was a problem hiding this comment.
This can be removed from the docs
|
Thanks for reviewing the PR! I have made the changes you have requested and have tested it. It works. Please do let me know if any further changes are required 👍 |
Summary
This PR refactors the GlazeWM Workspaces widget to use GlazeWM IPC as the source and adds
monitor_exclusivebehavior. Supersedes #679Implemented
monitor_exclusiveoption to GlazeWM workspaces config (default:true).monitor_exclusive: true(default): monitor-local rendering and shows all workspaces present in the current monitor IPC payload (including emptykeep_aliveworkspaces).monitor_exclusive: false: aggregated IPC rendering so active workspace count and global focused workspace are consistent across all monitor bars.focus --next-active-workspacefocus --prev-active-workspacehide_empty_workspaces(kept in schema/config for backward compatibility, no longer used as runtime visibility control for GlazeWM workspaces).persistent_workspacesremnants from the GlazeWM workspaces path.Why
Review direction was to avoid YASB-side workspace synthesis/parsing and rely on GlazeWM IPC behavior. This PR aligns with that by using IPC monitor/workspace data for visibility/state.
GlazeWM keep_alive context
keep_alivehad IPC/startup/reload edge cases. Related GlazeWM PR:This PR activates
keep_aliveworkspaces on startup and config reload, improving workspace availability consistency via IPC. But it's not a hard dependency as this can be worked around for now by simply restarting GlazeWM after settingkeep_alivefor required workspaces. YASB will automatically catch this.Behavior notes
monitor_exclusive: falsemonitor_exclusive: truekeep_aliveworkspaces.hide_empty_workspaceskeep_alivebehavior.Files changed
src/core/widgets/glazewm/workspaces.pysrc/core/utils/widgets/glazewm/client.pysrc/core/validation/widgets/glazewm/workspaces.pydocs/widgets/(Widget)-GlazeWM-Workspaces.mdschema.jsonValidation
monitor_exclusive: false(global focused highlight + shared active count)monitor_exclusive: true(monitor-local behavior with keep_alive visibility)