summaryrefslogtreecommitdiffstats
path: root/clerk_fzf/clerk_update
blob: 0dca425651762472dde92888066cd39605433c3e (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
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

TMUX_TMPDIR="/tmp/clerk/tmux"

# read global config
if [[ -f "/etc/clerk_fzf.conf" ]]; then
  source /etc/clerk_fzf.conf
fi

# read user config
if [[ -f "$HOME/.config/clerk/clerk_fzf.conf" ]]; then
  source $HOME/.config/clerk/clerk_fzf.conf
fi


screen=$(tmux list-panes -F "#W")

if [[ $1 == "--create-caches" ]]; then
  if [[ $animation == "1" ]]; then
    tmux new-session -s notify -n 'Updating Cache Files. Please wait a moment' -d 'sl'
  else
    tmux new-session -s notify -n 'Updating Cache Files. Please wait a moment' -d 'sh'
  fi
  tmux switchc -t notify
  clerk_fzf --update &
  pid=$!
  wait $pid
fi

tmux new-session -s music2 -n albums -d 'clerk_fzf --albums'
tmux new-window -t music2 -n tracks 'clerk_fzf --tracks'
tmux new-window -t music2 -n latest 'clerk_fzf --latest'
tmux new-window -t music2 -n queue 'ncmpcpp'

tmux rename-session -t music music_old
tmux rename-session -t music2 music
tmux switchc -t music
tmux findw -t music ${screen}
tmux kill-session -t music_old

if [[ $1 == "--create-caches" ]]; then
  tmux kill-session -t notify
fi