Skip to content

Commit

Permalink
Make sure killing the dummy window works from any tmux session
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertAudi committed Jun 2, 2019
1 parent 223f003 commit c7217e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/helpers/new_session.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
function __tsm::helpers::new_session() {
local session_name="$1" window_name="$2" window_working_directory="$3"
local dimensions="${4:-$(__tsm::utils::dimensions_parameters)}"
local session_working_directory dummy_window
local session_working_directory dummy_window dummy_window_index
session_working_directory="$HOME"
dummy_window="__dummy-window-${EPOCHREALTIME/./}-$(__tsm::utils::random)__"

command tmux new-session -d -s "$session_name" -n "$dummy_window" -c "$HOME" $=dimensions
dummy_window_index="$(command tmux list-windows -t "$session_name" | command grep "$dummy_window" | command cut -d: -f1)"

__tsm::helpers::add_window "$session_name" "$window_name" "$window_working_directory"
command tmux kill-window -t "$dummy_window"

command tmux kill-window -t "${session_name}:${dummy_window_index}"
}

0 comments on commit c7217e1

Please sign in to comment.