-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (82 loc) · 2.42 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·99 lines (82 loc) · 2.42 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
# ----------------------
# 🎨 COLORS & LOGGING
# ----------------------
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
RESET="\033[0m"
log() { echo -e "${YELLOW}➤ $*${RESET}"; }
success() { echo -e "${GREEN}✔ $*${RESET}"; }
error() { echo -e "${RED}✘ $*${RESET}" >&2; }
trap 'error "Interrupted. Exiting..."; exit 1' INT
# ----------------------
# 🧰 HELPERS
# ----------------------
get_yes_no() {
local reply
while true; do
read -rp "$1 (y/n): " reply || return 1
case "$reply" in
[Yy]) return 0 ;;
[Nn]) return 1 ;;
*) echo "Please answer y or n." ;;
esac
done
}
backup_file() {
[[ -e "$1" ]] && mv "$1" "$1.bak"
}
require_cmd() {
command -v "$1" >/dev/null || { error "$1 not found"; exit 1; }
}
# ----------------------
# 📁 PATHS
# ----------------------
CONFIG_DIR="$HOME/.config"
SKETCHYBAR_DIR="$CONFIG_DIR/sketchybar"
# ----------------------
# ✅ SANITY CHECKS
# ----------------------
require_cmd brew
require_cmd curl
# ----------------------
# 📦 INSTALL CONFIG
# ----------------------
backup_file "$SKETCHYBAR_DIR"
git clone --depth 1 https://github.com/phucisstupid/sketchybar-config "$SKETCHYBAR_DIR"
success "Cloned SketchyBar config."
# ----------------------
# ⚙ OPTIONAL DEPS
# ----------------------
if get_yes_no "✨ Install SketchyBar dependencies and helpers?"; then
if ! command -v jq >/dev/null; then
log "Installing jq..."
brew install jq
fi
log "Fetching latest icon_map.lua..."
latest_tag="$(curl -fsSL https://api.github.com/repos/kvndrsslr/sketchybar-app-font/releases/latest \
| jq -r '.tag_name')"
icon_path="$SKETCHYBAR_DIR/helpers/spaces_util/icon_map.lua"
mkdir -p "$(dirname "$icon_path")"
curl -fsSL \
"https://github.com/kvndrsslr/sketchybar-app-font/releases/download/${latest_tag}/icon_map.lua" \
-o "$icon_path"
log "Installing dependencies..."
brew tap FelixKratz/formulae
brew install lua switchaudio-osx media-control sketchybar
brew install --cask font-sketchybar-app-font font-maple-mono-nf
log "Installing SbarLua..."
tmpdir="$(mktemp -d)"
git clone --depth 1 https://github.com/FelixKratz/SbarLua.git "$tmpdir"
(cd "$tmpdir" && make install)
rm -rf "$tmpdir"
fi
# ----------------------
# 🔄 RELOAD
# ----------------------
brew services restart sketchybar || true
sketchybar --reload || true
success "SketchyBar installation complete."