evnp / tmex

tmux-execute – a lightweight tmux command & layout composer
MIT License
87 stars 5 forks source link

Top level width #6

Closed peterpme closed 2 months ago

peterpme commented 1 year ago

Hi there!

I'm trying to get your sane layout working but make the first pane 80% of the 2nd:

. .
___

I have tried:

1{31}2, 12{31} but none of these are working. am i doing something wrong? thank you!

evnp commented 1 year ago

Hi Peter, sorry about the long delay here. Life getting in the way this year.

Afraid I'm having a little trouble grokking the diagram, do I understand correctly that you're trying to achieve a layout like this?

┌────────┬───────────┐
│<--80-->│<---100--->│
│        │           │
│        ├───────────┤
│        │           │
│        │           │
└────────┴───────────┘

Top-level width is a tricky case for how simple the layout is, I'll think about how this might be improved. It sounds like you get this, but I'll put it on paper for clarity – this is due to the way the relative-pane-sizing notation works ({31} above). It's always applied to the single-digit "column" of the layout which precedes it, ie 1 in your first example 1{31}2 and 2 in your second example 12{31}. The sizing in these examples applies to the panes within the columns, not the widths of the columns themselves.

To produce the layout above, you'd need to wrap the whole layout in a "sublayout" like [12]{45} so that the relative sizing ({45}) applies to that single "row" of the layout represented by [12]:

$ tmex test -t [12]{45}
┌────────┬───────────┐
│<--80-->│<---100--->│
│        │           │
│        ├───────────┤
│        │           │
│        │           │
└────────┴───────────┘

You'd also need the -t flag (--transpose) because wrapping the whole thing in a sublayout without -t causes 1 and 2 to define rows instead of columns of the layout. -t flips this so they define columns again (as they would with a basic tmex test 12 command).

Let me know if that doesn't answer the right question, happy to help – with a better response timeline this time! And I'll put some more thought into how to support this use case in a clearer way (and open to ideas).

evnp commented 1 year ago

After some thought I've come to the conclusion that prefixing a layout with a sizing expression seems like the most elegant way to handle this use case. Normally a sizing clause – say {31} from your examples – would always refer to preceding number of panes. So currently 1{31}2 will apply the sizing to 1, and 12{31} will apply it to 2, but there's no existing case for {31}12 (it would currently be considered an invalid layout). We can use this last form to represent top-level layout sizing.

Internally this will operate by automatically transforming a layout like {31}12 into [12]{31} and flipping the --transpose option. So these two commands will become equivalent:

tmex test {31}12
tmex test -t [12]{31}
┌───────────────┬─────┐
│<------3------>│<-1->│
│               │     │
│               ├─────┤
│               │     │
│               │     │
└───────────────┴─────┘

I'll implement this soon.

evnp commented 1 year ago

Hello @peterpme, I've just published https://github.com/evnp/tmex/releases/tag/v2.0.0-rc.1 which implements the top-level-sizing feature described in above, along with some other things. Please let me know if you have a chance to try it, and any further issue reports are much appreciated.

I'll leave this open until the full v2.0.0 (non-release-candidate) is out – eta 2-3 weeks.

evnp commented 3 months ago

(at long last) I've released v2.0.0-rc.8 which intends to cover this functionality. This will become a 2.0.0 release in around a week. Please let me know if you come across any issues or changes needed in the meantime. Thanks!