summaryrefslogtreecommitdiffstats
path: root/clerk_fzf/clerk_starter
blob: 1074262b7d890c70f914d65a9e66f649a557d99d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

export TMUX_TMPDIR="/tmp/clerk/tmux"

if [[ ! -d "${TMUX_TMPDIR}" ]]; then
  mkdir -p "${TMUX_TMPDIR}"
fi

main() {
  tmux has-session -t music
  if [ $? != 0 ]; then
    tmux -f /etc/clerk/tmux.conf new-session -s music -n albums -d 'clerk_fzf --albums'
    tmux new-window -t music -n tracks 'clerk_fzf --tracks'
    tmux new-window -t music -n latest 'clerk_fzf --latest'
    tmux new-window -t music -n queue 'ncmpcpp'
  fi
  tmux attach -t music
}


if [[ $1 == "--help" || $1 == "-h" ]]; then
  echo "clerk: MPD Interface using fzf and tmux"
  echo "Copyright © 2016 Rasmus Steinke"
  echo ""
  echo "--help, -h    this help message"
  echo "--kill        kill running clerk sessions"
elif [[ $1 == "--kill" ]]; then
  tmux kill-session -t music
else
  main
fi