summaryrefslogtreecommitdiff
path: root/.local/bin/tmux-sessionizer
blob: 8f1c263fb1f96ac615515fe4da8c8140a9c83f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

DIR=$(fdfind --type d --strip-cwd-prefix -L -H | fzf)
SESSION_NAME="$DIR_$(date +%M%S)"

if [ -n "$DIR" ]
then
  tmux new-session -d -c "$DIR" -s "$SESSION_NAME"
  if [ -n "$TMUX" ]
  then
    tmux switch -t "$SESSION_NAME"
  else
    tmux attach -t "$SESSION_NAME"
  fi
fi