Say I split a window into 2 panes, the right one has width 20 cells. But when I resize the outside terminal emulator, the pane's width changes.
Is there any way to fix this? Because I wanna display info which is formatted to fit for 20 cells
|
Say I split a window into 2 panes, the right one has width 20 cells. But when I resize the outside terminal emulator, the pane's width changes. Is there any way to fix this? Because I wanna display info which is formatted to fit for 20 cells |
|||
|
|
|
As far as I can tell, tmux does not have any settings for fixing the width to a minimum value, only to a max value. This is because terminal windows can be resized to smaller than tmux's min value and tmux may not have a suitable way of handling this. That being said, if you have other tmux panes open, you could add a small script to PS1 ( You should look at the man pages for
If you are in the desired pane, all that must be done is to shrink the width from the the left -L or from the right -R by x characters necessary to arrive at 20. Essentially, if the pane is up against a wall taller than the pane, use it's direction for shrinking and the opposite for enlarging. If my pane is next to the right wall, use -R to reduce the width and -L to enlarge it. To get the right amount of characters, you need to know the current width of the pane, which can be found along with the pane id if you type
I am not yet sure of a way to tell which pane number you are currently in except by
This will give us the id number of all the panes in the current window. If we know the id# ($id) assuming it is against the right wall, we can resize the pane to 20 characters wide by:
Note that the resizeNum cannot be negative. If it is negative, then use the other side to resize to the absolute value of resizeNum (this can be automated, but I'll leave that up to you). Also, if you incorporate this into the code of your program, you can neglect the "-t $id" portion, but I do not know a way to automate finding $id from within your program. It may also be of use for you to look at Hope this helps! --- edited to add further info on automation --- My previous thought, was for you to go to a new pane and run I have rethought this idea since originally posting and I think it can reasonably be automated if the program running has a loop that can send shell commands. This is because we can run the program by essentially splitting the window. Here is an example of what I mean. The following code
runCodeSplit.sh:
test.sh:
NOTE: Unfortunately, the way I implemented it above, you should only really run it once per tmux window. The problem is that each time you run it, they will bunch up next to each other, which in turn will set them competing for space (one will shrink the other in order to expand and vice versa). You may be able to work around this problem, but I leave that up to you to figure out. |
|||||||
|
|
I'll post my variety since it won't hurt anyone, and perhaps fits someone better as-is. I use it to resize a pane in a irssi session inside tmux that reads the output from the Ignore the convoluted
|
|||||||
|