komorebi can't get input focus of tablacus after changing focus #106

Closed
opened 2026-01-05 14:48:22 +01:00 by adam · 7 comments
Owner

Originally created by @MasouShizuka on GitHub (Jul 14, 2022).

I use TablacusExplorer as explorer. When using komorebi, it can't get input focus when changing focus, causing shortcuts not work, as follows.

  • After focus or cycle- focus, tablacus lost the input focus and can't switch file by up and down.

https://user-images.githubusercontent.com/44764707/178860635-892c9ff9-bf50-4c70-bab3-e2b502bb1935.mp4

  • But I found that if changing focus by focus-follows-mouse, tablacus doesn't lose focus and work.

https://user-images.githubusercontent.com/44764707/178860914-d8a1b6ce-bcdf-43ba-ac5d-9501e226505d.mp4

So can I make focus and cycle-focus work like focus-follows-mouse in komorebi, or is it possible to fix?

Originally created by @MasouShizuka on GitHub (Jul 14, 2022). I use [TablacusExplorer](https://github.com/tablacus/TablacusExplorer) as explorer. When using `komorebi`, it can't get input focus when changing focus, causing shortcuts not work, as follows. - After `focus` or `cycle- focus`, `tablacus` lost the input focus and can't switch file by `up` and `down`. https://user-images.githubusercontent.com/44764707/178860635-892c9ff9-bf50-4c70-bab3-e2b502bb1935.mp4 - But I found that if changing focus by `focus-follows-mouse`, `tablacus` doesn't lose focus and work. https://user-images.githubusercontent.com/44764707/178860914-d8a1b6ce-bcdf-43ba-ac5d-9501e226505d.mp4 So can I make `focus` and `cycle-focus` work like `focus-follows-mouse` in `komorebi`, or is it possible to fix?
adam closed this issue 2026-01-05 14:48:22 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Jul 14, 2022):

I am able to reproduce this behaviour locally. komorebi uses SetFocus whenenver a window is focused using CLI commands

Sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.

I have noticed that when the Tablacus Explorer window is moved using the CLI commands (using SetWindowPos that the same behaviour happens and the keyboard focus is lost.

I'm not 100% sure, but since I have never seen this sort of issue before with other applications there is a chance that this might be related to the signal handling in the Tablacus Explorer app itself.

In the meantime I'll have a look through the Win32 docs to see if there are any other functions that may be called to change keyboard focus by window handle and report back if I find anything.

@LGUG2Z commented on GitHub (Jul 14, 2022): I am able to reproduce this behaviour locally. `komorebi` uses [`SetFocus`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setfocus) whenenver a window is [focused using CLI commands](https://github.com/LGUG2Z/komorebi/blob/master/komorebi/src/window.rs#L233) > Sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue. I have noticed that when the Tablacus Explorer window is moved using the CLI commands (using [`SetWindowPos`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos) that the same behaviour happens and the keyboard focus is lost. I'm not 100% sure, but since I have never seen this sort of issue before with other applications there is a chance that this might be related to the signal handling in the Tablacus Explorer app itself. In the meantime I'll have a look through the Win32 docs to see if there are any other functions that may be called to change keyboard focus by window handle and report back if I find anything.
Author
Owner

@MasouShizuka commented on GitHub (Jul 14, 2022):

I also tried workspacer, and it doesn't have such a problem.
Maybe this can help.

@MasouShizuka commented on GitHub (Jul 14, 2022): I also tried [workspacer](https://github.com/workspacer/workspacer), and it doesn't have such a problem. Maybe this can help.
Author
Owner

@LGUG2Z commented on GitHub (Jul 14, 2022):

This seems to be the only difference in focus handling. I just tried implementing this in komorebi but unfortunately I am seeing the same behaviour with Tablacus Explorer. 😞

@LGUG2Z commented on GitHub (Jul 14, 2022): [This](https://github.com/workspacer/workspacer/commit/1c02613cea485f1ae97f70d6399f7124aeb31297) seems to be the only difference in focus handling. I just tried implementing this in `komorebi` but unfortunately I am seeing the same behaviour with Tablacus Explorer. 😞
Author
Owner

@MasouShizuka commented on GitHub (Jul 15, 2022):

I found that an extra window opens when opening the TablacusExplorer for the first time(delete the config folder), and if the extra window is focused, the input focus will work, as follows.

https://user-images.githubusercontent.com/44764707/179135001-c220656e-230d-4b7b-a63a-507481c75579.mp4

@MasouShizuka commented on GitHub (Jul 15, 2022): I found that an extra window opens when opening the `TablacusExplorer` for the first time(delete the `config` folder), and if the extra window is focused, the input focus will work, as follows. https://user-images.githubusercontent.com/44764707/179135001-c220656e-230d-4b7b-a63a-507481c75579.mp4
Author
Owner

@MasouShizuka commented on GitHub (Jul 15, 2022):

I tried using win32 api in python to set foreground window, and it also doesn't have such a problem, as follows.
(komorebi is paused)

https://user-images.githubusercontent.com/44764707/179154093-adb3b72f-ccd7-412a-95cf-a2d7f3653072.mp4

And the hwnd of TablacusExplorer in the titlebar is from command komorebic state.

@MasouShizuka commented on GitHub (Jul 15, 2022): I tried using win32 api in python to set foreground window, and it also doesn't have such a problem, as follows. (`komorebi` is paused) https://user-images.githubusercontent.com/44764707/179154093-adb3b72f-ccd7-412a-95cf-a2d7f3653072.mp4 And the `hwnd` of `TablacusExplorer` in the titlebar is from command `komorebic state`.
Author
Owner

@LGUG2Z commented on GitHub (May 13, 2024):

There have been a lot of changes in the last two years, do you know if this is still an issue @MasouShizuka ?

@LGUG2Z commented on GitHub (May 13, 2024): There have been a lot of changes in the last two years, do you know if this is still an issue @MasouShizuka ?
Author
Owner

@MasouShizuka commented on GitHub (May 13, 2024):

This problem should be solved after 732aca77b5.

@MasouShizuka commented on GitHub (May 13, 2024): This problem should be solved after https://github.com/LGUG2Z/komorebi/commit/732aca77b54e3a1133408edc92727a45c0ec88fc.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#106