[PR #1413] [MERGED] fix(wm): fix eager focus on hidden stacked window #1392

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

📋 Pull Request Information

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

Base: masterHead: fix/eager-focus


📝 Commits (1)

  • 42d4f58 fix(wm): fix eager focus on hidden stacked window

📊 Changes

1 file changed (+27 additions, -14 deletions)

View changed files

📝 komorebi/src/process_command.rs (+27 -14)

📄 Description

When using the eager focus command to focus a window that was hidden on a stack on an unfocused workspace it would load the workspace focus the correct window but keep it cloaked with the previously focused window showing. This would happen because we were focusing the workspace before focusing the window which would create two window focus events, the first one for the previously focused window and the second one for the target window we wanted. The problem was that when the first event was handled it would again refocus that window and cloak the target window again so when the target window focus event came it would ignore it since the should_manage function would return false because the window was cloaked and had all its window styles as None, unless we had transparency enabled, in that case it would override it and create a focus loop.

This commit fixes this by not loading the newly focused workspace immediately. Instead we first focus the workspace if it is needed without loading it and mark it as needing to be loaded. Then we focus the correct target window and only then do we load the workspace. This way the workspace loads with the correct window already focused.

This is the same approach that is currently being done on the perform_reconciliation function when there is an alt-tab.


🔄 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/1413 **Author:** [@alex-ds13](https://github.com/alex-ds13) **Created:** 4/17/2025 **Status:** ✅ Merged **Merged:** 4/17/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `fix/eager-focus` --- ### 📝 Commits (1) - [`42d4f58`](https://github.com/LGUG2Z/komorebi/commit/42d4f585f2c89653ede544ce48e89b5da6fb07ec) fix(wm): fix eager focus on hidden stacked window ### 📊 Changes **1 file changed** (+27 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `komorebi/src/process_command.rs` (+27 -14) </details> ### 📄 Description When using the eager focus command to focus a window that was hidden on a stack on an unfocused workspace it would load the workspace focus the correct window but keep it cloaked with the previously focused window showing. This would happen because we were focusing the workspace before focusing the window which would create two window focus events, the first one for the previously focused window and the second one for the target window we wanted. The problem was that when the first event was handled it would again refocus that window and cloak the target window again so when the target window focus event came it would ignore it since the `should_manage` function would return `false` because the window was cloaked and had all its window styles as `None`, unless we had transparency enabled, in that case it would override it and create a focus loop. This commit fixes this by not loading the newly focused workspace immediately. Instead we first focus the workspace if it is needed without loading it and mark it as needing to be loaded. Then we focus the correct target window and only then do we load the workspace. This way the workspace loads with the correct window already focused. This is the same approach that is currently being done on the `perform_reconciliation` function when there is an alt-tab. <!-- 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:55:08 +01:00
adam closed this issue 2026-01-05 14:55:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1392