Toqozz / wired-notify

Lightweight notification daemon with highly customizable layout blocks, written in Rust.
MIT License
608 stars 28 forks source link

Question: centering posiiton of multiple elements? #61

Open BeyondMagic opened 2 years ago

BeyondMagic commented 2 years ago

I am using this type of positioning for some time now, but still confused at some things, for example this:

image

Usingo parent_anchor: BR, self_anchor: TR to have space downside and centering works for one -- however, when after adding other action labels with parent_anchor: MR, self_anchor: ML to the right, the parent doesn't count the new space to center horizontally.

I tried with multiple settings, a few go inside other elements, others straight go beyond the geometry of the notification. Is there any way to do this that I don't understand?

Whole config: https://github.com/BeyondMagic/MaGiCK/blob/main/.config/wired/wired.ron

Toqozz commented 2 years ago

Neat config, looks great!

This is technically possible with creative use of render criteria, but not at all ergonomic.

Basically, as long as you're able to get the blocks in the right positions for a certain number of actions, you can use render criteria to create different "sets" which just choose the layout based on that criteria. Obviously this gets pretty unwieldy pretty quickly. It's also a bit of a puzzle to figure out with variable width buttons -- for 1 action, you want the button to anchor MM->MM, but for 2 you want TR->MM and TL->MM, etc.

I've thought a bit about this and I think the best solution is probably to have some kind of "container" block which basically just grows to the size of all its children and then you can use that for positioning. It's just a bit difficult to implement so I haven't gotten around to it yet.

BeyondMagic commented 2 years ago

Understanble, thanks for the detailed response.

Toqozz commented 2 years ago

Reopening so I remember to work on this :)