dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 120d00afc66b4afd38529a022c28d06811b036a2
parent c499a9a76d8b0efcd262b51f1480093bc7efa1c7
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sat, 10 Sep 2022 21:31:40 -0400

tmux-session: Add support for ttysize

Diffstat:
Mbin/tmux-session | 23+++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/bin/tmux-session b/bin/tmux-session @@ -1,10 +1,20 @@ #!/bin/sh + +if type tput >/dev/null 2>&1 +then + columns=$(tput cols) + lines=$(tput lines) +elif type ttysize >/dev/null 2>&1 +then + columns=$(ttysize w) + lines=$(ttysize h) +fi + if [ "$1" = "-r" ] then for line in $(tmux list-sessions -F "#S") do session=$(echo $line | sed 's~:~~') - columns=$(tput cols) echo $session case $session in iterm|code) @@ -35,8 +45,7 @@ fi if echo $1 | grep rio > /dev/null 2>&1 then name=rio - columns=$(tput cols) - tmux new-session -d -x $columns -y $(tput lines) -s $name irssi + tmux new-session -d -x $columns -y $lines -s $name irssi tmux rename-window -t $name:1 chat width=$(($columns - 20)) tmux setw main-pane-width $width @@ -49,9 +58,8 @@ then elif [ $1 = "code" ] then name=code - columns=$(tput cols) width=$(($columns - 80 - 1)) - tmux new-session -d -x $columns -y $(tput lines) -s $name + tmux new-session -d -x $columns -y $lines -s $name tmux rename-window -t $name:1 code tmux setw main-pane-width $width tmux splitw -h -l 80 @@ -59,13 +67,12 @@ then elif [ $1 = "notes" ] then name=notes - tmux new-session -d -x $(tput cols` -y `tput lines) -s $name sncli + tmux new-session -d -x $columns -y $lines -s $name sncli elif [ $1 = "chat" ] then name=chat - columns=$(tput cols) width=$(($columns - 20)) - tmux new-session -d -x $columns -y $(tput lines) -s $name irssi + tmux new-session -d -x $columns -y $lines -s $name irssi tmux setw main-pane-width $width tmux splitw -h -l 20 cat ~/.irssi/nicklistfifo tmux selectl main-vertical