LGUG2Z / komorebi

A tiling window manager for Windows 🍉
https://lgug2z.github.io/komorebi/
Other
9.63k stars 200 forks source link

fix(wm): handle moving windows to/from floating workspaces #1075

Closed alex-ds13 closed 3 weeks ago

alex-ds13 commented 1 month ago

This commit fixes the issue related to moving windows to/from a floating workspace to a tiled workspace. Previously the start of the move would be ignored however when moving back from a tiled workspace since it didn't know about the existance of that window it would also "move" that workspace focused tiled window without physically moving it, leaving it in a weird state that seemed like it was unmanaged. This commit changes the way this mouse moves are handled and now also handles moving floating_windows and even monocle or maximized windows.

Fixes #1065

LGUG2Z commented 4 weeks ago

Hoping to take a closer look at this before the end of the week - I think I may have introduced a merge conflict though by merging other smaller pending PRs?

alex-ds13 commented 3 weeks ago

Hoping to take a closer look at this before the end of the week - I think I may have introduced a merge conflict though by merging other smaller pending PRs?

I've rebased it to master and fixed the merge conflict.

BTW @LGUG2Z just so you know, the changes that actually matter on the process_event.rs file are on the match arms: WindowManagerEvent::MoveResizeStart and WindowManagerEvent::MoveResizeEnd.

The arm WindowManagerEvent::Uncloack (and Show, Manage) seems to have a lot of scary changes but it does not. It simply has a new if ... else ... block at the start and the entire code that it had before was moved to the else part. This is the if ... else ... in question:

if matches!(event, WindowManagerEvent::Uncloak(_, _))
    && self.uncloack_to_ignore >= 1
{
    tracing::info!("ignoring uncloak after monocle move by mouse across monitors");
    self.uncloack_to_ignore = self.uncloack_to_ignore.saturating_sub(1);
} else {
    // the rest of the code as it was before
}

I wish git could notice that a change was simply that an entire block of code was indented and put inside another block, but it doesn't and instead it creates a bunch of small differences that look worse than it is.

This if block is related to the review I've made above. I couldn't find a way to "break" from a match block of code. So this was the best solution I could find. If you have a better idea tell me and I will change it.

LGUG2Z commented 3 weeks ago

Ah I was about to merge this one but I introduced even more conflicts by merging the alt-snap fix 🤦‍♀️

Can you resolve the conflicts again? I promise the next PR I'll merge will be this one!

alex-ds13 commented 3 weeks ago

Ah I was about to merge this one but I introduced even more conflicts by merging the alt-snap fix 🤦‍♀️

Can you resolve the conflicts again? I promise the next PR I'll merge will be this one!

It's done.

LGUG2Z commented 3 weeks ago

Done! 🎉