diff --git a/hooks/session-create.sh b/hooks/session-create.sh index 56b2da5..4b7705c 100755 --- a/hooks/session-create.sh +++ b/hooks/session-create.sh @@ -3,7 +3,7 @@ session_name=$(tmux display-message -p '#S') session_layout=~/.local/share/tmux/layouts/session-$session_name if [ -f $session_layout ]; then - tmux source-file $session_layout + $session_layout else tmux rename-window home fi diff --git a/layouts/session-local b/layouts/session-local index ca36653..f2f3549 100755 --- a/layouts/session-local +++ b/layouts/session-local @@ -1,24 +1,23 @@ -#!/usr/bin/env -S tmux source-file +#!/usr/bin/zsh -rename-window home +tmux rename-window home +`dirname $0`/window-auto -new-window -c ~/.config/nvim -rename-window config/nvim -run-shell '~/.local/share/tmux/layouts/window-auto' +tmux new-window -c ~/.config/nvim +tmux rename-window config/nvim +`dirname $0`/window-auto -new-window -c ~/.config/zsh -rename-window config/zsh -run-shell '~/.local/share/tmux/layouts/window-auto' +tmux new-window -c ~/.config/zsh +tmux rename-window config/zsh +`dirname $0`/window-auto -new-window -c ~/.config/tmux -rename-window config/tmux -run-shell '~/.local/share/tmux/layouts/window-auto' +tmux new-window -c ~/.config/tmux +tmux rename-window config/tmux +`dirname $0`/window-auto -new-window -c ~/.config/local -rename-window config/local -move-window -s local:config/local -t 9 -run-shell '~/.local/share/tmux/layouts/window-auto' +tmux new-window -c ~/.config/local +tmux rename-window config/local +tmux move-window -s local:config/local -t 9 +`dirname $0`/window-auto -select-window -t local:home - -# vim: ft=tmux +tmux select-window -t local:home diff --git a/layouts/session-main b/layouts/session-main index 175fb00..0e5b639 100755 --- a/layouts/session-main +++ b/layouts/session-main @@ -1,7 +1,5 @@ -#!/usr/bin/env -S tmux source-file +#!/usr/bin/env zsh -rename-session main -rename-window home -run-shell '~/.local/share/tmux/layouts/window-auto' - -# vim: ft=tmux +tmux rename-session main +tmux rename-window home +`dirname $0`/window-auto diff --git a/layouts/window-auto b/layouts/window-auto index f2f955e..da45c38 100755 --- a/layouts/window-auto +++ b/layouts/window-auto @@ -1,13 +1,11 @@ #!/usr/bin/env zsh -cols=`tput cols` -lines=`tput lines` +cols=`tmux display -p "#{pane_width}"` +lines=`tmux display -p "#{pane_height}"` 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 @@ -15,7 +13,7 @@ fi if [[ $ratio -ge 100 ]]; then # terminal is wide or square - if [[ `tput cols` -gt 230 ]]; then + if [[ $cols -gt 230 ]]; then # terminal is wide and large `dirname $0`/window-wide-right else diff --git a/layouts/window-tall b/layouts/window-tall index 30a4ad2..e604dc3 100755 --- a/layouts/window-tall +++ b/layouts/window-tall @@ -1,6 +1,6 @@ #!/usr/bin/env -S tmux source-file -split-window -v -l 34% +split-window -v -l 34% -c '#{pane_current_path}' select-pane -t 1 # vim: ft=tmux diff --git a/layouts/window-wide-left b/layouts/window-wide-left index cde917c..ebf5d70 100755 --- a/layouts/window-wide-left +++ b/layouts/window-wide-left @@ -1,6 +1,6 @@ #!/usr/bin/env -S tmux source-file -split-window -h -l 43% +split-window -h -l 43% -c '#{pane_current_path}' select-pane -t 1 # vim: ft=tmux diff --git a/layouts/window-wide-right b/layouts/window-wide-right index 9721828..28e378b 100755 --- a/layouts/window-wide-right +++ b/layouts/window-wide-right @@ -1,6 +1,6 @@ #!/usr/bin/env -S tmux source-file -split-window -h -l 57% +split-window -h -l 57% -c '#{pane_current_path}' select-pane -t 1 # vim: ft=tmux