Browse Source

Clean up tmu -e logic

Samuel W. Flint 1 year ago
parent
commit
a226c65112
1 changed files with 5 additions and 1 deletions
  1. 5 1
      tmu

+ 5 - 1
tmu

@@ -86,7 +86,11 @@ do
             TAB=${!OPTIND}
             OPTIND1=$(( OPTIND + 1 ))
             COMMAND=${!OPTIND1}
-            tmux new -s "${OPTARG}" -n "${TAB}" -d "${COMMAND}"
+            if tmux has-session -t "${OPTARG}" ; then
+                TMUX='' tmux attach-session -t "${OPTARG}" \; new-window -d -n "${TAB}" "${COMMAND}" \; detach-client
+            else
+                TMUX='' tmux new -s "${OPTARG}" -n "${TAB}" -d "${COMMAND}"
+            fi
             exit
             ;;
         h)