feat(wm): add padding per monitor

This commit adds the ability to set container and workspace padding per
monitor.

To do so (and to simplify any future need of changing some value per
monitor), and have it pass through to each workspace a new field was added
to `Workspace` called `globals` which has a new struct called
`WorkspaceGlobals`.

`WorkspaceGlobals` includes any global values that might be needed by
the workspace.

This field is updated by the monitor for all its workspaces whenever the
config is loaded or reloaded. It is also updated on `RetileAll` and on
the function `update_focused_workspace`.

This should make sure that every time a workspace needs to use it's
`update` function, it has all the `globals` up to date!

This also means that now the `update` function from workspaces doesn't
take any argument at all, reducing all the need to get all the
`work_area`, `work_area_offset`, `window_based_work_area_offset` or
`window_based_work_area_offset_limit` simplifying the callers of this
function quite a bit.

Lastly this commit has also (sort of accidentaly) fixed an existing bug
with the `move_workspace_to_monitor` function.

This was previous removing the workspace from a monitor, but wasn't
changing it's `focused_workspace_idx`, meaning that komorebi would get
all messed up after that command. For example, the `border_manager`
would get stuck and the komorebi-bar would crash.

Now, the `remove_focused_workspace` function also focuses the previous
workspace (which in turn will create a new workspace in case the removed
workspace was the last workspace).
This commit is contained in:
alex-ds13
2025-02-22 23:13:51 +00:00
committed by LGUG2Z
parent 13ee42276d
commit 2bbc269b9f
7 changed files with 193 additions and 121 deletions

View File

@@ -1075,6 +1075,11 @@
"workspaces"
],
"properties": {
"container_padding": {
"description": "Container padding (default: global)",
"type": "integer",
"format": "int32"
},
"window_based_work_area_offset": {
"description": "Window based work area offset (default: None)",
"type": "object",
@@ -1144,6 +1149,11 @@
}
}
},
"workspace_padding": {
"description": "Workspace padding (default: global)",
"type": "integer",
"format": "int32"
},
"workspaces": {
"description": "Workspace configurations",
"type": "array",
@@ -1346,7 +1356,7 @@
}
},
"workspace_padding": {
"description": "Container padding (default: global)",
"description": "Workspace padding (default: global)",
"type": "integer",
"format": "int32"
},