From b117a18b7a068ee7a20ffea83b6f475a93b1bfff Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Sun, 17 Apr 2016 08:51:49 -0500 Subject: [PATCH] add check for reattach-to-user-namespace if reattach-to-user-name-space exists, run it, otherwise just run the shell * create login-shell command to perform this check * update tmux.conf to run login-shell instead of reattach-to-user-namespace directly --- bin/login-shell | 10 ++++++++++ tmux/tmux.conf.symlink | 2 +- 2 files changed, 11 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..499d5f7 --- /dev/null +++ b/bin/login-shell @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +shell=$(basename "$SHELL") + +# check if reattach-to-user-namespace is available +if [ -n "$(command -v reattach-to-user-namespace)" ]; then + reattach-to-user-namespace -l "$shell" +else + exec "$shell -l" +fi diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink index 834d928..4643a47 100644 --- a/tmux/tmux.conf.symlink +++ b/tmux/tmux.conf.symlink @@ -1,4 +1,4 @@ -set -g default-command "reattach-to-user-namespace -l zsh" +set -g default-command "login-shell" # tmux display things in 256 colors set -g default-terminal "tmux-256color-italic" set -g status-utf8 on