From 3470b1632fff4e97426e41a4c20fbb385688b782 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 25 Aug 2013 09:25:15 +0000 Subject: [PATCH] Further enhance tmux's default command --- bin/login-shell | 12 ++++++++++++ tmux.conf | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 bin/login-shell diff --git a/bin/login-shell b/bin/login-shell new file mode 100755 index 0000000..2e6b52c --- /dev/null +++ b/bin/login-shell @@ -0,0 +1,12 @@ +#! /usr/bin/env bash + +# Ensure that tmux windows are by default named after the shell, rather than +# full path to the shell binary. +shell=$(basename "$SHELL") + +# If reattach-to-user-namespace is not available, just run the command. +if [ -n "$(command -v reattach-to-user-namespace)" ]; then + reattach-to-user-namespace -l "$shell" +else + exec "$shell" +fi diff --git a/tmux.conf b/tmux.conf index 98a786c..56b3647 100644 --- a/tmux.conf +++ b/tmux.conf @@ -13,7 +13,7 @@ set -g mouse-select-window on set -g history-limit 10240 # Mac OS X fix for pbcopy, pbpaste, and launchctl -set-option -g default-command "safe-reattach-to-user-namespace -l $SHELL" +set-option -g default-command "login-shell" # Load Theme source-file "${HOME}/.tmux/themes/powerline-block-green.tmuxtheme"