This commit adds the ability to set a 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 the Workspace called globals which has a new struct called WorkspaceGlobals which 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 which was 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, like the border_manager would get stuck and the komorebi-bar would crash. Now the remove_focused_workspace function also focus the previous workspace (which in turn will create a new workspace in case the removed one was the last workspace).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/LGUG2Z/komorebi/pull/1290
**Author:** [@alex-ds13](https://github.com/alex-ds13)
**Created:** 2/23/2025
**Status:** ✅ Merged
**Merged:** 2/23/2025
**Merged by:** [@LGUG2Z](https://github.com/LGUG2Z)
**Base:** `master` ← **Head:** `feature/workspace-globals`
---
### 📝 Commits (2)
- [`b55f639`](https://github.com/LGUG2Z/komorebi/commit/b55f6397bb40fba2b58f0101832b168bd2951569) feat(wm): add padding per monitor
- [`d43c9ae`](https://github.com/LGUG2Z/komorebi/commit/d43c9ae832dc7628da1e9fcc69a2ac00300e7bfe) docs(schema): update schema with monitor padding
### 📊 Changes
**7 files changed** (+193 additions, -121 deletions)
<details>
<summary>View changed files</summary>
📝 `komorebi-client/src/lib.rs` (+1 -0)
📝 `komorebi/src/monitor.rs` (+60 -7)
📝 `komorebi/src/reaper.rs` (+1 -13)
📝 `komorebi/src/static_config.rs` (+45 -1)
📝 `komorebi/src/window_manager.rs` (+26 -73)
📝 `komorebi/src/workspace.rs` (+49 -26)
📝 `schema.json` (+11 -1)
</details>
### 📄 Description
This commit adds the ability to set a 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 the `Workspace` called `globals` which has a new struct called `WorkspaceGlobals` which 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 which was 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, like the `border_manager` would get stuck and the komorebi-bar would crash. Now the `remove_focused_workspace` function also focus the previous workspace (which in turn will create a new workspace in case the removed one was the last workspace).
<!--
Please follow the Conventional Commits specification.
If you need to update your PR with changes from `master`, please run `git rebase master`.
By opening this PR, you confirm that you have read and understood this project's `CONTRIBUTING.md`.
-->
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/LGUG2Z/komorebi/pull/1290
Author: @alex-ds13
Created: 2/23/2025
Status: ✅ Merged
Merged: 2/23/2025
Merged by: @LGUG2Z
Base:
master← Head:feature/workspace-globals📝 Commits (2)
b55f639feat(wm): add padding per monitord43c9aedocs(schema): update schema with monitor padding📊 Changes
7 files changed (+193 additions, -121 deletions)
View changed files
📝
komorebi-client/src/lib.rs(+1 -0)📝
komorebi/src/monitor.rs(+60 -7)📝
komorebi/src/reaper.rs(+1 -13)📝
komorebi/src/static_config.rs(+45 -1)📝
komorebi/src/window_manager.rs(+26 -73)📝
komorebi/src/workspace.rs(+49 -26)📝
schema.json(+11 -1)📄 Description
This commit adds the ability to set a 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 the
Workspacecalledglobalswhich has a new struct calledWorkspaceGlobalswhich 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
RetileAlland on the functionupdate_focused_workspace. This should make sure that every time a workspace needs to use it'supdatefunction it has all theglobalsup to date!This also means that now the
updatefunction from workspaces doesn't take any argument at all, reducing all the need to get all thework_area,work_area_offset,window_based_work_area_offsetorwindow_based_work_area_offset_limitsimplifying 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_monitorfunction which was removing the workspace from a monitor but wasn't changing it'sfocused_workspace_idxmeaning that komorebi would get all messed up after that command, like theborder_managerwould get stuck and the komorebi-bar would crash. Now theremove_focused_workspacefunction also focus the previous workspace (which in turn will create a new workspace in case the removed one was the last workspace).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.