From: Iain Patterson Date: Fri, 1 Oct 2010 12:55:27 +0000 (+0100) Subject: Use tmux for sessions. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=59c39198581757eee1fc00cb707e0d60e5a7df0b;p=profile.git Use tmux for sessions. Use tmux with the Kerberos helper for the session alias. --- diff --git a/.profile.d/screen.bashrc b/.profile.d/screen.bashrc index c2b1014..e6a8b1e 100644 --- a/.profile.d/screen.bashrc +++ b/.profile.d/screen.bashrc @@ -18,7 +18,5 @@ if [ $? = 0 ]; then alias kscreen='' fi unset krenew - - alias session='bigscreen -rx -S session || kscreen bigscreen -S session' fi unset screen diff --git a/.profile.d/tmux.bashrc b/.profile.d/tmux.bashrc new file mode 100644 index 0000000..458c94f --- /dev/null +++ b/.profile.d/tmux.bashrc @@ -0,0 +1,9 @@ +# profile-requires: screen.bashrc +# XXX: Use a module. +tmux=$(PATH=$PATH:/comm/tmux/stable/bin find_working tmux 2>/dev/null) +if [ $? = 0 ]; then + alias session="bigtmux $tmux has -t session 2>/dev/null && tmux attach -t session || ktmux -T $tmux -s session" + if [ -n "$TMUX" ]; then + $tmux run-shell ktmux_helper ';' detach 2>/dev/null + fi +fi diff --git a/opt/bin/bigtmux b/opt/bin/bigtmux new file mode 100755 index 0000000..b3d083a --- /dev/null +++ b/opt/bin/bigtmux @@ -0,0 +1,20 @@ +#!/bin/bash +# +# bigtmux: Start tmux, resizing the current window to allow a status line in +# addition to an 87x24 display. +# Usage: bigtmux [args] +# + +# Resize only if we're at the default size. +size=$(stty size) +oldcols=${size##* } +cols=${oldcols:-80} +oldlines=${size%% *} +lines=${oldlines:-24} + +[ ${lines:-24} -lt 25 ] && lines=25 +[ ${cols:-80} -lt 87 ] && cols=87 +[ $cols = $oldcols -a $lines = $oldlines ] || usize $cols $lines + +exec ${1+"$@"} +