-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·73 lines (56 loc) · 1.55 KB
/
install.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
is_brew_installed() {
which brew >/dev/null
}
install_brew() {
echo 'installing brew'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
}
is_bitbar_installed() {
ls /Applications/BitBar.app >/dev/null
}
is_bitbar_running() {
pgrep BitBar >/dev/null
}
is_bitbar_plugin_folder_defined() {
defaults read com.matryer.BitBar pluginsDirectory >/dev/null
}
kill_bitbar() {
ps -ef | grep 'BitBar' | grep -v grep | awk '{print $2}' | xargs kill -9
}
define_bitbar_plugins_folder() {
echo "Plugins dir is being set automatically to ~/Documents/Bitbar-Plugins"
PLUGINS_DIR=${HOME}/Documents/Bitbar-Plugins
mkdir ${PLUGINS_DIR}
defaults write com.matryer.BitBar pluginsDirectory -string ${PLUGINS_DIR}
}
get_bitbar_plugins_folder() {
defaults read com.matryer.BitBar pluginsDirectory
}
install_bitbar() {
echo 'installing bitbar'
brew install --cask bitbar
}
launch_bitbar() {
echo 'opening bitbar'
open /Applications/BitBar.app
}
download_countdown_timer() {
echo 'downloading countdown timer'
curl https://raw.githubusercontent.com/kizzx2/bitbar-countdown-timer/a27f8b42e7d89c00bc0d04b4f8d2eca906e549c4/countdown_timer.1s.rb -o ${PLUGINS_DIR}/countdown_timer.1s.rb
chmod +x ${PLUGINS_DIR}/countdown_timer.1s.rb
}
if ! is_brew_installed; then
install_brew
fi
if ! is_bitbar_installed; then
install_bitbar
fi
if ! is_bitbar_plugin_folder_defined; then
define_bitbar_plugins_folder
fi
PLUGINS_DIR=$(get_bitbar_plugins_folder)
download_countdown_timer
kill_bitbar
launch_bitbar
exit