From 59c39198581757eee1fc00cb707e0d60e5a7df0b Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Fri, 1 Oct 2010 13:55:27 +0100 Subject: [PATCH] Use tmux for sessions. Use tmux with the Kerberos helper for the session alias. --- .profile.d/screen.bashrc | 2 -- .profile.d/tmux.bashrc | 9 +++++++++ opt/bin/bigtmux | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .profile.d/tmux.bashrc create mode 100755 opt/bin/bigtmux 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+"$@"} + -- 2.7.4