[BUG]: Unexpected behavior after enabling monocle mode on a window stack #343

Closed
opened 2026-01-05 14:49:52 +01:00 by adam · 3 comments
Owner

Originally created by @RaptDept on GitHub (Apr 18, 2024).

Describe the bug
Enabling monocle mode on a stack of windows causes unexpected behavior:

  • Toggling monocle mode off doesn't do anything.
  • Attempting to cycle through the stack will focus the next window in the stack, as expected, but the monocle window is hidden and there will be an empty tile in place of it, as if the two windows weren't stacked.
  • Triggering komorebic promote while stuck in monocle mode will cause a panic.

To Reproduce
Steps to reproduce the behavior:

  1. Stack two windows
  2. Set focus on the stack
  3. Turn monocle mode on
  4. Turn monocle mode off, notice that nothing happens. Do any of the following in this state:
  • Unstacking restores the windows to their unstacked state as expected
  • Cycling through the stack instead of unstacking causes the tiling behavior described above
  • Triggering komorebic promote will cause a panic and komorebi will stop responding (this can also happen in step 3)

Expected behavior

  • When enabling then disabling monocle mode on a stacked window, it should restore the stack and tiling prior to turning on monocle mode.
  • komorebic promote should probably do nothing but not cause a panic.

Screenshots and Videos
Add screenshots and videos to help explain your problem.

Operating System

OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22621 N/A Build 22621

komorebic check Output

KOMOREBI_CONFIG_HOME detected: C:\Users\[username]\.komorebi

Looking for configuration files in C:\Users\[username]\.komorebi

Found komorebi.json; this file can be passed to the start command with the --config flag

Found C:\Users\[username]\.config\whkdrc; key bindings will be loaded from here when whkd is started, and you can start it automatically using the --whkd flag

Additional context

2024-04-18T01:55:44.930419Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:55:44.931168Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}:focus_container{idx=1}: komorebi::workspace: focusing container
2024-04-18T01:55:44.931657Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:55:45.032177Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}: komorebi::process_event: processed: (hwnd: 198188, title: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE, exe: powershell.exe, class: ConsoleWindowClass)
2024-04-18T01:55:45.096368Z  INFO process_event{event=Hide(ObjectHide, Window { hwnd: 198188 })}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:55:45.096979Z  INFO process_event{event=Hide(ObjectHide, Window { hwnd: 198188 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:55:45.170695Z  INFO process_event{event=Hide(ObjectHide, Window { hwnd: 198188 })}: komorebi::process_event: processed: (hwnd: 198188, title: Administrator: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE, exe: powershell.exe, class: ConsoleWindowClass)
2024-04-18T01:55:45.330731Z  INFO process_command{Stop}: komorebi::process_command: received stop command, restoring all hidden windows and terminating process
2024-04-18T01:55:45.333977Z  INFO process_command{Stop}:restore_all_windows: komorebi::window_manager: restoring all hidden windows
2024-04-18T01:55:46.449943Z  INFO foreground_lock_timeout: komorebi::windows_api: current value of ForegroundLockTimeout is 0
2024-04-18T01:55:46.461309Z  INFO komorebi: creating window manager from static configuration file: C:\Users\[username]\.komorebi\komorebi-single.json
2024-04-18T01:55:46.468031Z  INFO init: komorebi::window_manager: initialising
2024-04-18T01:55:46.516351Z  INFO komorebi::process_command: listening on komorebi.sock
2024-04-18T01:55:46.535110Z  INFO komorebi::process_event: listening
2024-04-18T01:55:47.105698Z  INFO process_event{event=DisplayChange(Window { hwnd: 394828 })}: komorebi::process_event: processed: (hwnd: 394828, title: komorebi-hidden, exe: komorebi.exe, class: komorebi-hidden)
2024-04-18T01:55:47.502989Z  INFO process_command{AddSubscriberPipe("yasb-c6681530-fd26-11ee-8458-b48c9d8e08f0")}: komorebi::process_command: processed
2024-04-18T01:55:47.567699Z  INFO process_command{State}: komorebi::process_command: replying to state
2024-04-18T01:55:47.568150Z  INFO process_command{State}: komorebi::process_command: replying to state done
2024-04-18T01:55:47.569849Z  INFO process_command{State}: komorebi::process_command: processed
2024-04-18T01:55:47.633885Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 4985358 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:55:47.634544Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 4985358 })}:focus_container{idx=1}: komorebi::workspace: focusing container
2024-04-18T01:55:47.634975Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 4985358 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:55:47.980041Z ERROR komorebi::process_event: Invalid window handle. (0x80070578)
2024-04-18T01:55:47.992314Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.011335Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:55:48.085855Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0
2024-04-18T01:55:48.117235Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:55:48.118535Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:focus_container{idx=1}: komorebi::workspace: focusing container
2024-04-18T01:55:48.137323Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:55:48.166218Z ERROR komorebi::process_event: The parameter is incorrect. (0x80070057)
2024-04-18T01:55:48.180961Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.191718Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.207253Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.223568Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.240351Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.241147Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.251805Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.266079Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:55:48.344884Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0
2024-04-18T01:55:48.362148Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:55:48.362867Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:focus_container{idx=1}: komorebi::workspace: focusing container
2024-04-18T01:55:48.383351Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:55:48.405711Z ERROR komorebi::process_event: The parameter is incorrect. (0x80070057)
2024-04-18T01:55:48.419239Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.433690Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.435387Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.459838Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:55:48.496419Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0
2024-04-18T01:55:48.516291Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:55:48.525289Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:focus_container{idx=1}: komorebi::workspace: focusing container
2024-04-18T01:55:48.538900Z  INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:55:48.562118Z ERROR komorebi::process_event: The parameter is incorrect. (0x80070057)
2024-04-18T01:55:48.571761Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed
2024-04-18T01:55:48.572658Z  INFO process_event{event=Hide(ObjectHide, Window { hwnd: 4985358 })}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:55:48.631851Z  INFO process_event{event=Hide(ObjectHide, Window { hwnd: 4985358 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0
2024-04-18T01:55:48.639651Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:48.641746Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:48.643237Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:48.646157Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:48.648000Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:48.650521Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:48.653000Z ERROR komorebi::process_event: Invalid window handle. (os error 1400)
2024-04-18T01:55:56.354937Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 1249470 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:55:56.355891Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 1249470 })}:focus_container{idx=1}: komorebi::workspace: focusing container
2024-04-18T01:55:56.372511Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass)
2024-04-18T01:56:01.687435Z  INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}: komorebi::window_manager: adding window to container
2024-04-18T01:56:01.712562Z  INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}:focus_window{idx=1}: komorebi::container: focusing window
2024-04-18T01:56:01.713667Z  INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:56:01.726573Z  INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:56:01.788820Z  INFO process_command{StackWindow(Left)}: komorebi::process_command: processed
2024-04-18T01:56:01.795749Z  INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2024-04-18T01:56:02.776156Z  INFO process_command{ToggleMonocle}:toggle_monocle:monocle_on: komorebi::window_manager: enabling monocle
2024-04-18T01:56:02.781346Z  INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating
2024-04-18T01:56:02.805207Z  INFO process_command{ToggleMonocle}: komorebi::process_command: processed
2024-04-18T01:56:05.213979Z  INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off: komorebi::window_manager: disabling monocle
2024-04-18T01:56:05.216762Z  INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:56:05.223620Z  INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating
2024-04-18T01:56:05.231396Z ERROR komorebi::process_command: The parameter is incorrect. (0x80070057)
2024-04-18T01:56:15.036733Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}: komorebi::window_manager: cycling container windows
2024-04-18T01:56:15.039523Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:56:15.048868Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:56:15.049509Z ERROR komorebi::process_command: Invalid window handle. (0x80070578)
2024-04-18T01:56:15.058254Z  INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2024-04-18T01:56:15.062349Z  INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass)
2024-04-18T01:56:18.537240Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}: komorebi::window_manager: cycling container windows
2024-04-18T01:56:18.541748Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:focus_window{idx=1}: komorebi::container: focusing window
2024-04-18T01:56:18.550805Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:56:18.551324Z ERROR komorebi::process_command: Invalid window handle. (0x80070578)
2024-04-18T01:56:18.559803Z  INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2024-04-18T01:56:18.576341Z  INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass)
2024-04-18T01:56:21.179190Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}: komorebi::window_manager: cycling container windows
2024-04-18T01:56:21.182615Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:56:21.190657Z  INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating
2024-04-18T01:56:21.191236Z ERROR komorebi::process_command: Invalid window handle. (0x80070578)
2024-04-18T01:56:21.199751Z  INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2024-04-18T01:56:21.202219Z  INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass)
2024-04-18T01:56:21.531834Z ERROR komorebi::process_command: Invalid window handle. (0x80070578)
2024-04-18T01:56:23.476305Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 594262 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-04-18T01:56:23.477675Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 594262 })}:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:56:23.486572Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1)
2024-04-18T01:57:06.356035Z  INFO process_command{ToggleMonocle}:toggle_monocle:monocle_on: komorebi::window_manager: enabling monocle
2024-04-18T01:57:06.361747Z  INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating
2024-04-18T01:57:06.380383Z  INFO process_command{ToggleMonocle}: komorebi::process_command: processed
2024-04-18T01:57:07.059329Z  INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off: komorebi::window_manager: disabling monocle
2024-04-18T01:57:07.063478Z  INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off:focus_container{idx=0}: komorebi::workspace: focusing container
2024-04-18T01:57:07.067688Z  INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating
2024-04-18T01:57:07.069479Z ERROR komorebi::process_command: Invalid window handle. (0x80070578)
2024-04-18T01:57:08.061869Z  INFO process_command{Promote}:promote_container_to_front: komorebi::window_manager: promoting container
2024-04-18T01:57:08.063935Z ERROR process_command{Promote}:promote_container_to_front: komorebi: panicked at komorebi\src\workspace.rs:551:51:
removal index (is 0) should be < len (is 0) panic.file="komorebi\\src\\workspace.rs" panic.line=551 panic.column=51
Originally created by @RaptDept on GitHub (Apr 18, 2024). **Describe the bug** Enabling monocle mode on a stack of windows causes unexpected behavior: - Toggling monocle mode off doesn't do anything. - Attempting to cycle through the stack will focus the next window in the stack, as expected, but the monocle window is hidden and there will be an empty tile in place of it, as if the two windows weren't stacked. - Triggering `komorebic promote` while stuck in monocle mode will cause a panic. **To Reproduce** Steps to reproduce the behavior: 1. Stack two windows 2. Set focus on the stack 3. Turn monocle mode on 4. Turn monocle mode off, notice that nothing happens. Do any of the following in this state: - Unstacking restores the windows to their unstacked state as expected - Cycling through the stack instead of unstacking causes the tiling behavior described above - Triggering `komorebic promote` will cause a panic and komorebi will stop responding (this can also happen in step 3) **Expected behavior** - When enabling then disabling monocle mode on a stacked window, it should restore the stack and tiling prior to turning on monocle mode. - `komorebic promote` should probably do nothing but not cause a panic. **Screenshots and Videos** Add screenshots and videos to help explain your problem. **Operating System** ``` OS Name: Microsoft Windows 11 Pro OS Version: 10.0.22621 N/A Build 22621 ``` **`komorebic check` Output** ``` KOMOREBI_CONFIG_HOME detected: C:\Users\[username]\.komorebi Looking for configuration files in C:\Users\[username]\.komorebi Found komorebi.json; this file can be passed to the start command with the --config flag Found C:\Users\[username]\.config\whkdrc; key bindings will be loaded from here when whkd is started, and you can start it automatically using the --whkd flag ``` **Additional context** ```2024-04-18T01:55:44.897427Z ERROR komorebi::process_event: there is no container/window 2024-04-18T01:55:44.930419Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:55:44.931168Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}:focus_container{idx=1}: komorebi::workspace: focusing container 2024-04-18T01:55:44.931657Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:55:45.032177Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 198188 })}: komorebi::process_event: processed: (hwnd: 198188, title: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE, exe: powershell.exe, class: ConsoleWindowClass) 2024-04-18T01:55:45.096368Z INFO process_event{event=Hide(ObjectHide, Window { hwnd: 198188 })}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:55:45.096979Z INFO process_event{event=Hide(ObjectHide, Window { hwnd: 198188 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:55:45.170695Z INFO process_event{event=Hide(ObjectHide, Window { hwnd: 198188 })}: komorebi::process_event: processed: (hwnd: 198188, title: Administrator: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE, exe: powershell.exe, class: ConsoleWindowClass) 2024-04-18T01:55:45.330731Z INFO process_command{Stop}: komorebi::process_command: received stop command, restoring all hidden windows and terminating process 2024-04-18T01:55:45.333977Z INFO process_command{Stop}:restore_all_windows: komorebi::window_manager: restoring all hidden windows 2024-04-18T01:55:46.449943Z INFO foreground_lock_timeout: komorebi::windows_api: current value of ForegroundLockTimeout is 0 2024-04-18T01:55:46.461309Z INFO komorebi: creating window manager from static configuration file: C:\Users\[username]\.komorebi\komorebi-single.json 2024-04-18T01:55:46.468031Z INFO init: komorebi::window_manager: initialising 2024-04-18T01:55:46.516351Z INFO komorebi::process_command: listening on komorebi.sock 2024-04-18T01:55:46.535110Z INFO komorebi::process_event: listening 2024-04-18T01:55:47.105698Z INFO process_event{event=DisplayChange(Window { hwnd: 394828 })}: komorebi::process_event: processed: (hwnd: 394828, title: komorebi-hidden, exe: komorebi.exe, class: komorebi-hidden) 2024-04-18T01:55:47.502989Z INFO process_command{AddSubscriberPipe("yasb-c6681530-fd26-11ee-8458-b48c9d8e08f0")}: komorebi::process_command: processed 2024-04-18T01:55:47.567699Z INFO process_command{State}: komorebi::process_command: replying to state 2024-04-18T01:55:47.568150Z INFO process_command{State}: komorebi::process_command: replying to state done 2024-04-18T01:55:47.569849Z INFO process_command{State}: komorebi::process_command: processed 2024-04-18T01:55:47.633885Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 4985358 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:55:47.634544Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 4985358 })}:focus_container{idx=1}: komorebi::workspace: focusing container 2024-04-18T01:55:47.634975Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 4985358 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:55:47.980041Z ERROR komorebi::process_event: Invalid window handle. (0x80070578) 2024-04-18T01:55:47.992314Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.011335Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:55:48.085855Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0 2024-04-18T01:55:48.117235Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:55:48.118535Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:focus_container{idx=1}: komorebi::workspace: focusing container 2024-04-18T01:55:48.137323Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 463424 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:55:48.166218Z ERROR komorebi::process_event: The parameter is incorrect. (0x80070057) 2024-04-18T01:55:48.180961Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.191718Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.207253Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.223568Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.240351Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.241147Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.251805Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.266079Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:55:48.344884Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0 2024-04-18T01:55:48.362148Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:55:48.362867Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:focus_container{idx=1}: komorebi::workspace: focusing container 2024-04-18T01:55:48.383351Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 856574 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:55:48.405711Z ERROR komorebi::process_event: The parameter is incorrect. (0x80070057) 2024-04-18T01:55:48.419239Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.433690Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.435387Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.459838Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:55:48.496419Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0 2024-04-18T01:55:48.516291Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:55:48.525289Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:focus_container{idx=1}: komorebi::workspace: focusing container 2024-04-18T01:55:48.538900Z INFO process_event{event=Show(ObjectShow, Window { hwnd: 17961494 })}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:55:48.562118Z ERROR komorebi::process_event: The parameter is incorrect. (0x80070057) 2024-04-18T01:55:48.571761Z ERROR komorebi::process_event: there is no monitor associated with this window, it may have already been destroyed 2024-04-18T01:55:48.572658Z INFO process_event{event=Hide(ObjectHide, Window { hwnd: 4985358 })}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:55:48.631851Z INFO process_event{event=Hide(ObjectHide, Window { hwnd: 4985358 })}: komorebi::process_event: reaped 1 orphan window(s) and 0 orphaned container(s) on monitor: 0, workspace: 0 2024-04-18T01:55:48.639651Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:48.641746Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:48.643237Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:48.646157Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:48.648000Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:48.650521Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:48.653000Z ERROR komorebi::process_event: Invalid window handle. (os error 1400) 2024-04-18T01:55:56.354937Z INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 1249470 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:55:56.355891Z INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 1249470 })}:focus_container{idx=1}: komorebi::workspace: focusing container 2024-04-18T01:55:56.372511Z INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass) 2024-04-18T01:56:01.687435Z INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}: komorebi::window_manager: adding window to container 2024-04-18T01:56:01.712562Z INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}:focus_window{idx=1}: komorebi::container: focusing window 2024-04-18T01:56:01.713667Z INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:56:01.726573Z INFO process_command{StackWindow(Left)}:add_window_to_container{direction=Left}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:56:01.788820Z INFO process_command{StackWindow(Left)}: komorebi::process_command: processed 2024-04-18T01:56:01.795749Z INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1) 2024-04-18T01:56:02.776156Z INFO process_command{ToggleMonocle}:toggle_monocle:monocle_on: komorebi::window_manager: enabling monocle 2024-04-18T01:56:02.781346Z INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating 2024-04-18T01:56:02.805207Z INFO process_command{ToggleMonocle}: komorebi::process_command: processed 2024-04-18T01:56:05.213979Z INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off: komorebi::window_manager: disabling monocle 2024-04-18T01:56:05.216762Z INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:56:05.223620Z INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating 2024-04-18T01:56:05.231396Z ERROR komorebi::process_command: The parameter is incorrect. (0x80070057) 2024-04-18T01:56:15.036733Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}: komorebi::window_manager: cycling container windows 2024-04-18T01:56:15.039523Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:56:15.048868Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:56:15.049509Z ERROR komorebi::process_command: Invalid window handle. (0x80070578) 2024-04-18T01:56:15.058254Z INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1) 2024-04-18T01:56:15.062349Z INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass) 2024-04-18T01:56:18.537240Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}: komorebi::window_manager: cycling container windows 2024-04-18T01:56:18.541748Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:focus_window{idx=1}: komorebi::container: focusing window 2024-04-18T01:56:18.550805Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:56:18.551324Z ERROR komorebi::process_command: Invalid window handle. (0x80070578) 2024-04-18T01:56:18.559803Z INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1) 2024-04-18T01:56:18.576341Z INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass) 2024-04-18T01:56:21.179190Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}: komorebi::window_manager: cycling container windows 2024-04-18T01:56:21.182615Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:56:21.190657Z INFO process_command{CycleStack(Previous)}:cycle_container_window_in_direction{direction=Previous}:update_focused_workspace{follow_focus=false}: komorebi::window_manager: updating 2024-04-18T01:56:21.191236Z ERROR komorebi::process_command: Invalid window handle. (0x80070578) 2024-04-18T01:56:21.199751Z INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1) 2024-04-18T01:56:21.202219Z INFO process_event{event=Cloak(ObjectCloaked, Window { hwnd: 1249470 })}: komorebi::process_event: processed: (hwnd: 1249470, title: Primary — New Issue · LGUG2Z/komorebi — Mozilla Firefox, exe: firefox.exe, class: MozillaWindowClass) 2024-04-18T01:56:21.531834Z ERROR komorebi::process_command: Invalid window handle. (0x80070578) 2024-04-18T01:56:23.476305Z INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 594262 })}:focus_window{idx=0}: komorebi::container: focusing window 2024-04-18T01:56:23.477675Z INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 594262 })}:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:56:23.486572Z INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 594262 })}: komorebi::process_event: processed: (hwnd: 594262, title: komorebi.log - Visual Studio Code, exe: Code.exe, class: Chrome_WidgetWin_1) 2024-04-18T01:57:06.356035Z INFO process_command{ToggleMonocle}:toggle_monocle:monocle_on: komorebi::window_manager: enabling monocle 2024-04-18T01:57:06.361747Z INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating 2024-04-18T01:57:06.380383Z INFO process_command{ToggleMonocle}: komorebi::process_command: processed 2024-04-18T01:57:07.059329Z INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off: komorebi::window_manager: disabling monocle 2024-04-18T01:57:07.063478Z INFO process_command{ToggleMonocle}:toggle_monocle:monocle_off:focus_container{idx=0}: komorebi::workspace: focusing container 2024-04-18T01:57:07.067688Z INFO process_command{ToggleMonocle}:toggle_monocle:update_focused_workspace{follow_focus=true}: komorebi::window_manager: updating 2024-04-18T01:57:07.069479Z ERROR komorebi::process_command: Invalid window handle. (0x80070578) 2024-04-18T01:57:08.061869Z INFO process_command{Promote}:promote_container_to_front: komorebi::window_manager: promoting container 2024-04-18T01:57:08.063935Z ERROR process_command{Promote}:promote_container_to_front: komorebi: panicked at komorebi\src\workspace.rs:551:51: removal index (is 0) should be < len (is 0) panic.file="komorebi\\src\\workspace.rs" panic.line=551 panic.column=51 ```
adam added the bug label 2026-01-05 14:49:52 +01:00
adam closed this issue 2026-01-05 14:49:52 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Apr 18, 2024):

Repro'd by myself and @raggi earlier this week, but I can't remember if this was fixed on master or not yet.

@LGUG2Z commented on GitHub (Apr 18, 2024): Repro'd by myself and @raggi earlier this week, but I can't remember if this was fixed on master or not yet.
Author
Owner

@raggi commented on GitHub (Apr 19, 2024):

I believe this is https://github.com/LGUG2Z/komorebi/issues/758

I think the root cause is that now that we're sending ObjectDestroy messages down into process_event now - previously they would error in should_manage, which prevented any of those messages to be passed in at all (relying on reap to cleanup instead). This then raised a pre-existing but not-exercised bug where ObjectDestroy assumes that the object being destroyed is always in the "focsued workspace" / "focused container", which isn't always the case.

This is essentially a whole class of bug around event processing using focused_* to route events. Another example in this class is the "invisible windows still affecting layout", like Discord frequently triggers. (Repro for discord is: open discord, focus another window in another workspace, hit the X on discord without focusing it - Komorebi won't correctly understand what changed, resulting a few different kinds of issue). Another class of this bug is: Open an unmanaged window, e.g. WhatsApp (without extra app definitions), which is layered and ignored. Focus a managed window, then drag whatsapp by title - the managed window will get moved when the drag completes.

As a broad stroke we need to move away from "focused_*" for workspace/containers in event processing, instead we need to look at WindowsApi::foreground_window to get an HWND (which requires retries sometimes if the foreground window is mid-switch), then hunt for that HWND in the containers to perform container modifications. The general notion of "focused container" needs to be kept in sync with WindowsApi::foreground_window (most events will need to check this for result - even ObjectFocus - as I've seen ObjectFocus,SystemForeground come in pointing at the wrong window (e.g. the stackbar windows create these, but never get focused/activated, and when those events arrive WindowsApi::foreground_window shows a different window being focused)). The notion of a focused container will then only be used to implement commands, and never to target or originate externally generated mutations (window drags, alt-tabs, click-to-focus changes, etc).

@raggi commented on GitHub (Apr 19, 2024): I believe this is https://github.com/LGUG2Z/komorebi/issues/758 I think the root cause is that now that we're sending ObjectDestroy messages down into process_event now - previously they would error in should_manage, which prevented any of those messages to be passed in at all (relying on reap to cleanup instead). This then raised a pre-existing but not-exercised bug where ObjectDestroy assumes that the object being destroyed is always in the "focsued workspace" / "focused container", which isn't always the case. This is essentially a whole class of bug around event processing using `focused_*` to route events. Another example in this class is the "invisible windows still affecting layout", like Discord frequently triggers. (Repro for discord is: open discord, focus another window in another workspace, hit the X on discord without focusing it - Komorebi won't correctly understand what changed, resulting a few different kinds of issue). Another class of this bug is: Open an unmanaged window, e.g. WhatsApp (without extra app definitions), which is layered and ignored. Focus a managed window, then drag whatsapp by title - the managed window will get moved when the drag completes. As a broad stroke we need to move away from "focused_*" for workspace/containers in event processing, instead we need to look at WindowsApi::foreground_window to get an HWND (which requires retries sometimes if the foreground window is mid-switch), then hunt for that HWND in the containers to perform container modifications. The general notion of "focused container" needs to be kept in sync with `WindowsApi::foreground_window` (most events will need to check this for result - even ObjectFocus - as I've seen ObjectFocus,SystemForeground come in pointing at the wrong window (e.g. the stackbar windows create these, but never get focused/activated, and when those events arrive WindowsApi::foreground_window shows a different window being focused)). The notion of a focused container will then only be used to implement _commands_, and never to target or originate externally generated mutations (window drags, alt-tabs, click-to-focus changes, etc).
Author
Owner

@LGUG2Z commented on GitHub (Apr 20, 2024):

Closing as a dupe, will track work on #758

@LGUG2Z commented on GitHub (Apr 20, 2024): Closing as a dupe, will track work on #758
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#343