Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Stacked windows are not moved together using komorebic move commands #832

Closed
CtByte opened this issue May 18, 2024 · 9 comments
Closed
Labels
bug Something isn't working

Comments

@CtByte
Copy link

CtByte commented May 18, 2024

Describe the bug
When stacked windows are moved using the commands, only the top window is moved. The behaviour is slightly different when moving on the same monitor or when moving to an other monitor.

I am using the UltrawideVerticalStack layout.


To Reproduce
Steps to reproduce the behavior (see video):

  1. Have 3 windows open and 2 of them stacked.
  2. Current order: Monitor 1 b, Monitor 1 a, Firefox
  3. Use the komorebic move right command. Monitor 1 a stuck on the left.
  4. Current order: Firefox, Monitor 1 a, Monitor 1 b
  5. Click the stackbar tab of Monitor 1 a. Monitor 1 a jumps to the left.
  6. Current order: Firefox, Monitor 1 b, Monitor 1 a

In case moving to an other monitor, the "stuck" window will not jump under the stackbar when clicking on its tag. An other window (that is not in the stack, Firefox in my example) needs to be focused for that to happen.
But even this does not always work, so it can be tested again if this can be fixed for a single monitor.


Expected behavior
Stacked windows are moved together.


Videos

Recording.2024-05-17.201515.mp4

Operating System

OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22631 N/A Build 22631

komorebic check Output

No KOMOREBI_CONFIG_HOME detected, defaulting to C:\Users\{UserName}

Looking for configuration files in C:\Users\{UserName}

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
When I switch to another workplace and back at step 4 (instead of clicking the tab), the "stuck" window jumps to the correct position like in step 6. The same seems to be true when I change the workspace (where the "stuck" window is) on the multi monitor test.

@CtByte CtByte added the bug Something isn't working label May 18, 2024
@LGUG2Z
Copy link
Owner

LGUG2Z commented May 18, 2024

I'm not able to reproduce this exactly but I do have some jank when using the mouse instead of the hotkeys.

Since the hotkeys work for now I'm gonna leave this open until I can split out the stackbar into its own module like I did for the borders and see if this is one of the those edge cases that gets fixed by the more isolated design 🤞

@CtByte
Copy link
Author

CtByte commented May 18, 2024

I could not always reproduce this exactly either, but let's see what comes up when you get the time to make the stackbar module 🤞

@CtByte
Copy link
Author

CtByte commented May 18, 2024

I am running the monitor-madness branch and I do not think that I saw this issue when I ran the main a while back, but I could be wrong.

I have the feeling that the stackbar used to hide stacked windows that were not visible (behind the focused tab). Almost like when you change between workspaces.

@LGUG2Z
Copy link
Owner

LGUG2Z commented May 19, 2024

I think this is fixed on the stackbar manager branch now 🤞

@CtByte
Copy link
Author

CtByte commented May 19, 2024

I tried out the stackbar-manager branch and when I only use the hotkeys it seems to be fine even when I move stacks to another monitor and cycle through tabs.

Once I click the tabs it behaves differently, similar to what I described as hidden stacked windows being stuck and the stack being scattered around 2 monitors.

I am also getting this error in the console when I am clicking the tabs (after moving the stack to another monitor):

(not sure how much of the logs I should grab)

[...]

2024-05-19T12:12:21.983119Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 394850 })}: komorebi::process_event: processed: (hwnd: 394850, title: Monitor 1 B, exe: WindowsTerminal.exe, class: CASCADIA_HOSTING_WINDOW_CLASS)
2024-05-19T12:12:21.990523Z  INFO process_event{event=Uncloak(ObjectUncloaked, Window { hwnd: 132920 })}: komorebi::process_event: processed: (hwnd: 132920, title: Monitor 1 A, exe: WindowsTerminal.exe, class: CASCADIA_HOSTING_WINDOW_CLASS)
2024-05-19T12:12:22.002761Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 132920 })}:focus_monitor{idx=1}:
 komorebi::window_manager: focusing monitor
2024-05-19T12:12:22.003171Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 132920 })}:focus_window{idx=0}: komorebi::container: focusing window
2024-05-19T12:12:22.004547Z  INFO process_event{event=FocusChange(SystemForeground, Window { hwnd: 132920 })}:update_focused_workspace{follow_focus=true trigger_focus=false}: komorebi::window_manager: updating
2024-05-19T12:12:22.005305Z ERROR komorebi::process_event:
   0: there is no container/window

Location:
   komorebi\src\workspace.rs:445

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 11 frames hidden ⋮
  12: komorebi::workspace::impl$1::focus_container_by_window::closure$0<unknown>
      at D:\Workspaces\git\LGUG2Z\komorebi\komorebi\src\workspace.rs:445
  13: enum2$<core::option::Option<usize> >::ok_or_else<usize,eyre::Report,komorebi::workspace::impl$1::focus_container_by_window::closure_env$0><unknown>
      at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\option.rs:1231
  14: komorebi::workspace::Workspace::focus_container_by_window<unknown>
      at D:\Workspaces\git\LGUG2Z\komorebi\komorebi\src\workspace.rs:443
  15: komorebi::window_manager::WindowManager::process_event<unknown>
      at D:\Workspaces\git\LGUG2Z\komorebi\komorebi\src\process_event.rs:262
  16: komorebi::process_event::listen_for_events::closure$0<unknown>
      at D:\Workspaces\git\LGUG2Z\komorebi\komorebi\src\process_event.rs:45
  17: core::hint::black_box<unknown>
      at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97\library\core\src\hint.rs:334
                                ⋮ 12 frames hidden ⋮

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
Warning: SpanTrace capture is Unsupported.
Ensure that you've setup a tracing-error ErrorLayer and the semver versions are compatible
2024-05-19T12:12:22.071714Z  INFO komorebi::workspace_reconciliator: focusing alt-tabbed window

[...]

And when I use the hotkey cycle-stack command instead of clicking the tabs, the scattered stack recovers.

So I am guessing there is something done differently when the command is used and when the mouse is used.

@LGUG2Z
Copy link
Owner

LGUG2Z commented May 19, 2024

0140e8a

I tried reproducing both of the issues you described after making some changes in the commit above and everything looks okay to me now; no cross-monitor move errors or rendering of windows in old positions on my end 🤞

@CtByte
Copy link
Author

CtByte commented May 19, 2024

I tried to test it in every possible way I could think of and it worked. 🎉

I moved the stack and clicked the tabs with mouse only, command only and a mix of the two.

The only thing I could not do is moving the stack by mouse on the same monitor to swap places with another window. When I move a none stacked window to swap places with a stack that worked.

Recording.2024-05-19.161735.mp4

It can be that I am just clumsy, but I would consider this to be a win.

Thank you for taking the time!

@CtByte CtByte closed this as completed May 19, 2024
@LGUG2Z
Copy link
Owner

LGUG2Z commented May 19, 2024

Mouse moving has also been fixed here: b68ba2f

@CtByte
Copy link
Author

CtByte commented May 19, 2024

I confirm, indeed it is 👍

LGUG2Z added a commit that referenced this issue May 19, 2024
This commit removes all stackbar-related code from Container, Workspace,
process_command, process_event etc. and centralizes it in the new
stackbar_manager module.

Instead of trying to figure out where in process_event and
process_command we should make stackbar-related changes, a notification
gets sent to a channel that stackbar_manager listens to whenever an
event or command has finished processing.

The stackbar_manager listener, upon receiving a notification, acquires a
lock on the WindowManager instance and updates stackbars for the focused
workspace on every monitor; this allows us to centralize all edge case
handling within the stackbar_manager listener's loop.

Global state related to stackbars has also been moved into the
stackbar_manager module, which also tracks the state of stackbar objects
(STACKBAR_STATE), mappings between stackbars and containers
(STACKBARS_CONTAINERS) and the mappings between stackbars and monitors
(STACKBARS_MONITORS).

A number of edge cases around stackbar behaviour have been addressed in
this commit (re #832), and stackbars now respect the "border_style"
configuration option.
LGUG2Z added a commit that referenced this issue May 19, 2024
This commit removes all stackbar-related code from Container, Workspace,
process_command, process_event etc. and centralizes it in the new
stackbar_manager module.

Instead of trying to figure out where in process_event and
process_command we should make stackbar-related changes, a notification
gets sent to a channel that stackbar_manager listens to whenever an
event or command has finished processing.

The stackbar_manager listener, upon receiving a notification, acquires a
lock on the WindowManager instance and updates stackbars for the focused
workspace on every monitor; this allows us to centralize all edge case
handling within the stackbar_manager listener's loop.

Global state related to stackbars has also been moved into the
stackbar_manager module, which also tracks the state of stackbar objects
(STACKBAR_STATE), mappings between stackbars and containers
(STACKBARS_CONTAINERS) and the mappings between stackbars and monitors
(STACKBARS_MONITORS).

A number of edge cases around stackbar behaviour have been addressed in
this commit (re #832), and stackbars now respect the "border_style"
configuration option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants