First it changed the known_hwnds held by the WindowManager to be a HashMap of window handles (isize) to a pair of monitor_idx, workspace_idx (usize, usize).
Then it changes the reaper to have a cache of hwnds which is updated by the WindowManager when they change. The reaper has a thread that is continuously checking this cache to see if there is any window handle that no longer exists. When it finds them, the thread sends a notification to a channel which is then received by the reaper on another thread that actually does the work on the WindowManager by removing said windows.
This means that the reaper no longer tries to access and lock the WindowManager every second like it used to, but instead it only does it when it actually needs, when a window actually needs to be reaped. This means that we can make the thread that checks for orphan windows run much more frequently since it won't influence the rest of komorebi.
🔄 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/1287
**Author:** [@alex-ds13](https://github.com/alex-ds13)
**Created:** 2/22/2025
**Status:** ✅ Merged
**Merged:** 2/22/2025
**Merged by:** [@LGUG2Z](https://github.com/LGUG2Z)
**Base:** `master` ← **Head:** `feature/reaper-rework`
---
### 📝 Commits (1)
- [`ff6ceaf`](https://github.com/LGUG2Z/komorebi/commit/ff6ceafed85da43f9ba55ecafea1c64b2805ae40) feat(reaper): rework reaper logic to make it faster
### 📊 Changes
**7 files changed** (+283 additions, -119 deletions)
<details>
<summary>View changed files</summary>
📝 `komorebi/src/main.rs` (+1 -1)
📝 `komorebi/src/monitor_reconciliator/mod.rs` (+6 -5)
📝 `komorebi/src/process_command.rs` (+3 -0)
📝 `komorebi/src/process_event.rs` (+32 -73)
📝 `komorebi/src/reaper.rs` (+174 -37)
📝 `komorebi/src/static_config.rs` (+1 -1)
📝 `komorebi/src/window_manager.rs` (+66 -2)
</details>
### 📄 Description
This PR changes the way the reaper works.
First it changed the `known_hwnds` held by the `WindowManager` to be a HashMap of window handles (isize) to a pair of monitor_idx, workspace_idx (usize, usize).
Then it changes the reaper to have a cache of hwnds which is updated by the `WindowManager` when they change. The reaper has a thread that is continuously checking this cache to see if there is any window handle that no longer exists. When it finds them, the thread sends a notification to a channel which is then received by the reaper on another thread that actually does the work on the `WindowManager` by removing said windows.
This means that the reaper no longer tries to access and lock the `WindowManager` every second like it used to, but instead it only does it when it actually needs, when a window actually needs to be reaped. This means that we can make the thread that checks for orphan windows run much more frequently since it won't influence the rest of komorebi.
<!--
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/1287
Author: @alex-ds13
Created: 2/22/2025
Status: ✅ Merged
Merged: 2/22/2025
Merged by: @LGUG2Z
Base:
master← Head:feature/reaper-rework📝 Commits (1)
ff6ceaffeat(reaper): rework reaper logic to make it faster📊 Changes
7 files changed (+283 additions, -119 deletions)
View changed files
📝
komorebi/src/main.rs(+1 -1)📝
komorebi/src/monitor_reconciliator/mod.rs(+6 -5)📝
komorebi/src/process_command.rs(+3 -0)📝
komorebi/src/process_event.rs(+32 -73)📝
komorebi/src/reaper.rs(+174 -37)📝
komorebi/src/static_config.rs(+1 -1)📝
komorebi/src/window_manager.rs(+66 -2)📄 Description
This PR changes the way the reaper works.
First it changed the
known_hwndsheld by theWindowManagerto be a HashMap of window handles (isize) to a pair of monitor_idx, workspace_idx (usize, usize).Then it changes the reaper to have a cache of hwnds which is updated by the
WindowManagerwhen they change. The reaper has a thread that is continuously checking this cache to see if there is any window handle that no longer exists. When it finds them, the thread sends a notification to a channel which is then received by the reaper on another thread that actually does the work on theWindowManagerby removing said windows.This means that the reaper no longer tries to access and lock the
WindowManagerevery second like it used to, but instead it only does it when it actually needs, when a window actually needs to be reaped. This means that we can make the thread that checks for orphan windows run much more frequently since it won't influence the rest of komorebi.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.