#!/bin/bash

OUTPUT_FILE="/tmp/tmux-focus-last"
which=$1

if [[ $which == "in" ]]; then
  in=$2
  out=$3
  [[ "$out" == "$in" ]] || echo "$out" > "$OUTPUT_FILE"
elif [[ $which == "switch" ]]; then
  last=$(cat $OUTPUT_FILE)
  tmux select-window -t $last
  tmux select-pane -t $last
fi

