From 4fa4d5e482b3d7286a5647b47567dab554742122 Mon Sep 17 00:00:00 2001
From: Philipp Schmitt <philipp@schmitt.co>
Date: Sat, 6 Jun 2020 10:06:05 +0200
Subject: [PATCH] Fix TMUX module for Termux hosts

---
 modules/tmux/init.zsh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh
index 5c51855f..4f0eda4b 100644
--- a/modules/tmux/init.zsh
+++ b/modules/tmux/init.zsh
@@ -38,7 +38,13 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && "$TERM_PRO
   fi
 
   # Attach to the 'prezto' session or to the last session used. (detach first)
-  exec tmux $_tmux_iterm_integration attach-session -d
+  if (( $+commands[termux-info] )); then
+    # Simlate exec on Termux
+    tmux -f "$tmux_config" $_tmux_iterm_integration attach-session -d
+    exit "$?"
+  else
+    exec tmux $_tmux_iterm_integration attach-session -d
+  fi
 fi
 
 #