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

Improve window positioning when toggling tiling on #1125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AshtonOhms
Copy link

Hi folks! This is a quality of life change I've been working on. I frequently switch back and forth between using tiling and floating windows, and thought it would be nice to be able to position windows in floating mode and preserve those positions when turning on tiling.

This change updates the tiling layout code to attempt to preserve relative window positioning and sizes as much as possible when turning on toggling.

At a high level, the algorithm for this is to iteratively:

  • Find candidate positions to "split" the screen based on window geometry
  • Determine which candidate positions best minimize overlap with windows
  • Assign windows to either side of the split - if a side has one window, insert a Mapped leaf into the tree, otherwise create a Group and placeholders for the windows to be solved.
  • Repeat this process until all placeholder leafs have been solved.

Here's a small demo video: Demo

This is the first time I've written a significant amount of Rust, so any feedback on anything non-idiomatic would be appreciated. Cheers!

This change updates the tiling layout code to attempt
to preserve relative window positioning and sizes as much as
possible when turning on toggling.

At a high level, the algorithm for this is to iteratively:
* Find candidate positions to "split" the screen based
  on window geometry
* Determine which candidate positions best minimize overlap
  with windows
* Assign windows to either side of the split - if a side has
  one window, insert a `Mapped` leaf into the tree, otherwise
  create a `Group` and placeholders for the windows to be solved.
* Repeat this process until all placeholder leafs have been solved.
@Drakulix
Copy link
Member

Not a bad approach at all and I like the idea, but this likely needs to go through @pop-os/ux before I can consider merging this. Thanks for working on this!

@maria-komarova
Copy link

Looks like a good improvement to me. Maybe I'm missing some edge cases. I guess depending on the layout one might want the windows to occupy more standard half and quarter tiles but it is difficult to say if this would be the case more frequently. It probably needs testing in usage, at least internally before we merge and release it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants