YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
4.12k stars 123 forks source link

implement `always_center_single_column` layout option #638

Closed elkowar closed 2 months ago

elkowar commented 2 months ago

This option basically configures niri such that, regardless of the center focused column option, windows are centered if there's only one column in the workspace.

YaLTeR commented 2 months ago

How does this interact with the rest of centered column special casing? E.g. horizontal resizing goes twice as fast in centered mode.

elkowar commented 2 months ago

Fixed both style issues, and made it such that the new flag is also respected in resizing and the other places where CenterFocusedColumn::Always is being checked 👍🏻

vreon commented 2 months ago

Lurking Niri user here, hello all! :wave:

One behavior I like from Karousel is that it centers the view whenever all columns can fit on the display. I'm wondering if that's something we eventually want to replicate in Niri and whether or not that affects this PR.

Video from Karousel's README:

https://github.com/peterfajdiga/karousel/assets/22796326/2ab62d18-09c7-45f9-8fda-e5e36b8d7a02

YaLTeR commented 2 months ago

Well, it's out of scope for this PR at least, because it's quite a bit different.

I thought about it a while ago but decided against it, at least by default, since on my setup I find it convenient to have windows flushed to the side even when they total to shorter than the screen width.

YaLTeR commented 2 months ago

There's still one issue left: Column::tile_offsets_iter() also has a centering check which now needs to somehow know whether that column is the only column on the workspace. This check is needed for interactive resizing without transactions (or with really slow windows), to know whether to center the slow window in the column on size mismatch, or flush it left/right.

I'll need to think of the best way to pass this flag in.

YaLTeR commented 2 months ago

Actually, I just left a FIXME comment because with resize transactions that case is quite hard to trigger. Thanks!