[PR #1319] [MERGED] refactor: alt-tab rework #1322

Closed
opened 2026-01-05 14:54:53 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1319
Author: @alex-ds13
Created: 3/4/2025
Status: Merged
Merged: 4/1/2025
Merged by: @LGUG2Z

Base: masterHead: feat/alt-tab-rework


📝 Commits (2)

  • db5d1e1 refactor(wm): refactor alt-tab reconciliation
  • e3333d0 remove(wm): remove workspace_reconciliator

📊 Changes

6 files changed (+139 additions, -171 deletions)

View changed files

📝 komorebi/src/border_manager/mod.rs (+0 -3)
📝 komorebi/src/lib.rs (+0 -1)
📝 komorebi/src/main.rs (+0 -2)
📝 komorebi/src/process_event.rs (+135 -34)
📝 komorebi/src/workspace.rs (+4 -1)
komorebi/src/workspace_reconciliator.rs (+0 -130)

📄 Description

This is a refactor of the alt-tab reconciliation. This PR gets rid of the workspace_reconciliator, hence removing another source of potential issues with WM locks.

To replace it there are two simple new functions:

  • needs_reconciliation(): checks if the window with the Show or Uncloak event is already handled by komorebi and if it is, checks if it is a window on an unfocused workspace or a hidden window on a stack container. If this is the case then it means the user alt-tabbed into some window and we need to reconcile the currently focused monitor, workspace, container and window on komorebi to the ones from the window the user just alt-tabbed into. This function returns the monitor/workspace index pair of the window in question.
  • perform_reconciliation(): this function actually performs the previously mentioned reconciliation. If the window was on a stack it makes sure to update the focused window of that stack even if that stack is on the currently focused workspace. If there was a monocle on the workspace of that window, then it toggles the monocle off so that we can give focus to the alt-tabbed window.

This also fixes 2 bugs related to the alt-tab:

  • Previously, if you alt-tabbed to an unfocused window on the currently focused workspace it would bring that window to front and put focus on it, however komorebi wouldn't know about it and would still think you had focus on the previously focused container. This is fixed with this change.
  • Previously, if you alt-tabbed to a window on another workspace that wasn't the window focused on that workspace before it would change workspaces to the correct one, however it would focus the previously focused container instead of keeping focus on the window the user just alt-tabbed into. This is fixed with this change.

I'm making this a draft since it is a big change and I'm not sure exactly of the reasons that lead you to make the workspace_reconciliator in the first place. I'm not sure if there was a specific reason to need to have the reconciliation being done on another thread with a 100ms delay with all that that entails. From my tests, this version of mine works just fine like it used to with the added benefit of the aforementioned bug fixes. I haven't encountered any issues with alt-tab yet. There was also some situations before where komorebi would think some event was an alt-tab when in fact it wasn't and it would send a notification and perform a workspace reconciliation. That also doesn't seem to be happening anymore.

In spite of my tests revealing no issues so far, I still think this should be kept as a draft for a while until at least a couple more people can test it out!

So I'm calling out for @LGUG2Z, @CtByte and any others that can help test this!

Also I've seen this discussion #1275 which is what first prompted to look into the alt-tab to fix the mentioned issue, so I would also like to ping @f34r1335 in case you are able to test this PR as well and see if it works well for you!


🔄 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/1319 **Author:** [@alex-ds13](https://github.com/alex-ds13) **Created:** 3/4/2025 **Status:** ✅ Merged **Merged:** 4/1/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `feat/alt-tab-rework` --- ### 📝 Commits (2) - [`db5d1e1`](https://github.com/LGUG2Z/komorebi/commit/db5d1e1b21a427d385a1b9fbdec59120d30f58ab) refactor(wm): refactor alt-tab reconciliation - [`e3333d0`](https://github.com/LGUG2Z/komorebi/commit/e3333d0847504515ebd4f7ddf79c3f94a1b3a174) remove(wm): remove workspace_reconciliator ### 📊 Changes **6 files changed** (+139 additions, -171 deletions) <details> <summary>View changed files</summary> 📝 `komorebi/src/border_manager/mod.rs` (+0 -3) 📝 `komorebi/src/lib.rs` (+0 -1) 📝 `komorebi/src/main.rs` (+0 -2) 📝 `komorebi/src/process_event.rs` (+135 -34) 📝 `komorebi/src/workspace.rs` (+4 -1) ➖ `komorebi/src/workspace_reconciliator.rs` (+0 -130) </details> ### 📄 Description This is a refactor of the `alt-tab` reconciliation. This PR gets rid of the `workspace_reconciliator`, hence removing another source of potential issues with WM locks. To replace it there are two simple new functions: - `needs_reconciliation()`: checks if the window with the `Show` or `Uncloak` event is already handled by komorebi and if it is, checks if it is a window on an unfocused workspace or a hidden window on a stack container. If this is the case then it means the user alt-tabbed into some window and we need to reconcile the currently focused monitor, workspace, container and window on komorebi to the ones from the window the user just alt-tabbed into. This function returns the monitor/workspace index pair of the window in question. - `perform_reconciliation()`: this function actually performs the previously mentioned reconciliation. If the window was on a stack it makes sure to update the focused window of that stack even if that stack is on the currently focused workspace. If there was a monocle on the workspace of that window, then it toggles the monocle off so that we can give focus to the alt-tabbed window. This also fixes 2 bugs related to the alt-tab: - Previously, if you alt-tabbed to an unfocused window on the currently focused workspace it would bring that window to front and put focus on it, however komorebi wouldn't know about it and would still think you had focus on the previously focused container. This is fixed with this change. - Previously, if you alt-tabbed to a window on another workspace that wasn't the window focused on that workspace before it would change workspaces to the correct one, however it would focus the previously focused container instead of keeping focus on the window the user just alt-tabbed into. This is fixed with this change. I'm making this a draft since it is a big change and I'm not sure exactly of the reasons that lead you to make the `workspace_reconciliator` in the first place. I'm not sure if there was a specific reason to need to have the reconciliation being done on another thread with a 100ms delay with all that that entails. From my tests, this version of mine works just fine like it used to with the added benefit of the aforementioned bug fixes. I haven't encountered any issues with `alt-tab` yet. There was also some situations before where komorebi would think some event was an alt-tab when in fact it wasn't and it would send a notification and perform a workspace reconciliation. That also doesn't seem to be happening anymore. In spite of my tests revealing no issues so far, I still think this should be kept as a draft for a while until at least a couple more people can test it out! So I'm calling out for @LGUG2Z, @CtByte and any others that can help test this! Also I've seen this discussion #1275 which is what first prompted to look into the `alt-tab` to fix the mentioned issue, so I would also like to ping @f34r1335 in case you are able to test this PR as well and see if it works well for you! <!-- 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>
adam added the pull-request label 2026-01-05 14:54:53 +01:00
adam closed this issue 2026-01-05 14:54:53 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1322