How to resize all tmux panes at once to fit the screen size and display resolution? - tmux

I have created 4 panes in one window - as I flip between my 13" laptop to 27" monitor, the tmux panes's relative positions do not adjust themselves. How to resize them all at once?

For your tmux.conf, perhaps you're looking for something along the lines of:
set-hook -g client-resized resize-pane
Notes:
set-hook "hooks" events to commands.
client-resized occurs whenever the client is resized.
resize-pane or resizep (same) resizes panes on the current window, assuming pane layout is proportional.

Related

How to shuffle the order of panes in a tmux window?

I would like to shuffle the order of panes in a tmux window.
I didn't find any instructions about it in the tmux help or cheatsheet, except for swapping specific panes.
Is there a way to shuffle the order of panes?
You can rotate all the panes in a window by using the rotate-window command. I use the following binding to rotate all the panes in my window:
bind-key -n M-r rotate-window -Ut :+
(Alt+r rotates all panes in window)

Annoying padding between tmux bar and bottom of terminal window when maximised

I am using tmux inside of a gnome-terminal.
When I first open a window (with the default size being 80x24) the tmux bar sits snugly at the bottom of the window. When I maximise the terminal window, however, an annoyingly large gap appears underneath the tmux bar.
maximised gnome-terminal tmux session with gap under tmux bar
This is my .tmux.conf:
set-option -g default-command bash
# remap prefix to Control + a
unbind-key C-b
set-option -g prefix C-a
bind-key C-a send-prefix
bind-key C-a-h split-window -h #Split panes vertically
# time/no(0) time between C-a and command
set -s escape-time 0
#set-option -u repeat-time #global setting, "delete" repeat-time
set-option -g -q mouse on #activate mouse
How do I get the tmux bar to sit as it does in the small this when I maximise the terminal window?
80x24 gnome-terminal window with tmux bar located correctly
You will have to adjust your font size. The gap is introduced since the height of terminal window is not exactly N-lines high. If you really hate that gap, you may either enlarge or shrink your font size until you find one that fits your screen.

How to change the position of pane in Tmux

I want to change the postion of a pane such as that I want to change pane 4 to pane 3 after pane 3 exits.
To change pane 4 to pane 3 after pane 3 exits:
C-b { move the current pane to the previous position
Here are more shortcuts for moving panes around:
C-b } move the current pane to the next position
C-b C-o rotate window ‘up’ (i.e. move all panes)
C-b M-o rotate window ‘down’
C-b ! move the current pane into a new separate
window (‘break pane’)
C-b :move-pane -t :3.2
split window 3's pane 2 and move the current pane there
Source: tmux cheatsheet
The latest version of tmux (1.7) supports renumbering of windows.
If you just want to change the number of window 4 to 3, do this in window 4:
move-window -t 3

Specify pane percentage in tmuxinator project

How can I specify a pane percentage in tmuxinator ?
Eg:
project_name: ad_dev
project_root: ~/Programming/WWW/Rails/projects/ApparelDreamDev
rvm: ruby-1.9.2-p290#apparel_dev
pre: SQL
tabs:
- editor:
layout: main-vertical
panes:
- vim 75%
- #empty, will just run plain bash
- top
eg: the vim pane would take 75% of the screen... is there a way to specify this ? or where in the documentation should I look ? Can't seem to find it anywhere.
The layout should be specified in the layout: line. But you are not limited to the five preset layouts (such as main-vertical). From the man page:
In addition, select-layout may be used to apply a previously used layout -
the list-windows command displays the layout of each window in a form
suitable for use with select-layout. For example:
$ tmux list-windows
0: ksh [159x48]
layout: bb62,159x48,0,0{79x48,0,0,79x48,80,0}
$ tmux select-layout bb62,159x48,0,0{79x48,0,0,79x48,80,0}
tmux automatically adjusts the size of the layout for the current window
size. Note that a layout cannot be applied to a window with more panes
than that from which the layout was originally defined.
First set up your layout just how you like it - you can adjust widths with resize-pane until it is just right for you. Then run tmux list-windows. And then you should be able to use the layout: line from the output unaltered in tmuxinator.conf
So based on the output from your gist:
0: tmux [208x73] [layout b147,208x73,0,0[208x62,0,0,208x10,0,63{104x10,0,63,103x10,105,63}]] (active)
The relevant section of the tmuxinator conf file should be:
- editor:
layout: b147,208x73,0,0[208x62,0,0,208x10,0,63{104x10,0,63,103x10,105,63}]
panes:
- vim
- #empty, will just run plain bash
- top

Dynamically re-size RadSplitter to displayed panes

Need to re-size the RadSplitter control on my WebUserControl to the total size of the displayed (not collapsed) panes.
For instance, I have 2 panes displayed within a RadSplitter. Each of these panes has a height of 250px. If one of these panes is collapsed, I only want the RadSplitter to take up space for 250px in height. If both panes are opened (none collapsed), I want the RadSplitter to take up space for 500px in height. This needs to be able to change in a live environment so that, if the user opens or closes a pane it makes the appropriate adjustments to the RadSplitter's height property.
Any idea's...?
Thanks for your help!
What I would do is listed to the OnClientCollapsing event of the splitter and within it change the height of the main splitter div with javascript.
Check the below link:
http://www.telerik.com/support/kb/aspnet-ajax/details/initially-resize-the-radsplitter-according-to-its-content
They have good solution for this problem.

Resources