On Fri, May 07, 2021 at 09:10:45AM -0700, Shay Agros wrote:
> Hi,
> This functionality feels to me like it can be possible but I can't seem to 
> find it.
> I want to get the panes id of all panes in a window *by their geometrical 
> location*. Meaning that I need to know what is the index of the upper-left 
> pane, the index of the pane to its right etc.
> 
> Ideally, I could describe a window's panes and have their geometric 
> location and dimension inside a window (for each pane know its x, y and 
> height, width) so that I could match between their location and their ids, 
> but I couldn't find such information.
> 
> I also tried using something like the following:
>     first=$(tmux display-message -p -t {top-left} '#{pane_id}')
>     second=$(tmux display-message -p -t ${first} -t {right-of} 
> '#{pane_id}') 
>     third=$(tmux display-message -p -t ${first} -t {down-of} '#{pane_id}') 
>     fourth=$(tmux display-message -p -t ${third} -t {right-of} 
> '#{pane_id}') 
> 
> but I don't seem to be able to concatenate the '-t' parameters so that it 
> would work relatively to the one before it.
> I guess I would be able to make it work if I actually change the focus and 
> call `display-message` each time, but this would create an annoying jitter 
> on the screen (this should happen fast, and I don't really need the focus 
> to change).
> 
> Also I don't want to rely on having only 4 panes (in which case I could use 
> {top-left}, {bottom-left} and similar), and I don't want to rely on 
> creating the panes in a specific order (which would give them subsequent 
> ids) but rather to only depend on the pane's geometrical location when 
> invoking my command.
> 
> Does the functionality I'm looking for exists ? Alternatively, is it 
> difficult to implement ? (I'm guessing tmux does hold the dimensions and 
> location of each pane inside a window).

What about something like this:

    tmux list-panes -F '#{pane_top} #{pane_left} #{pane_index}' | sort -n

this should list panes top-down and left-to-right.

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/20210507181126.uecx6hllndicu5lc%40gmail.com.

Reply via email to