Add meta window layout that automatically chooses split
This commit is contained in:
parent
905460fee4
commit
7bc20823de
28
layouts/window-auto
Executable file
28
layouts/window-auto
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
cols=`tput cols`
|
||||||
|
lines=`tput lines`
|
||||||
|
width=$(( $cols / 2 )).0
|
||||||
|
height=$lines.0
|
||||||
|
ratio=$(( ($width / $height) * 100 ))
|
||||||
|
|
||||||
|
# echo "size: ( $width,$height ) ratio: $ratio"
|
||||||
|
|
||||||
|
if [[ $cols -lt 140 ]] && [[ $lines -lt 70 ]]; then
|
||||||
|
# terminal is too small
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $ratio -ge 100 ]]; then
|
||||||
|
# terminal is wide or square
|
||||||
|
if [[ `tput cols` -gt 230 ]]; then
|
||||||
|
# terminal is wide and large
|
||||||
|
`dirname $0`/window-wide-right
|
||||||
|
else
|
||||||
|
# terminal is wide and small
|
||||||
|
tmux split-window -h -l 50%
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# terminal is tall
|
||||||
|
`dirname $0`/window-tall
|
||||||
|
fi
|
@ -19,6 +19,7 @@
|
|||||||
- session-local
|
- session-local
|
||||||
- session-main
|
- session-main
|
||||||
- session-visor
|
- session-visor
|
||||||
|
- window-auto
|
||||||
- window-tall
|
- window-tall
|
||||||
- window-wide-left
|
- window-wide-left
|
||||||
- window-wide-right
|
- window-wide-right
|
||||||
|
Loading…
x
Reference in New Issue
Block a user