-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·98 lines (87 loc) · 3.32 KB
/
setup.sh
File metadata and controls
executable file
·98 lines (87 loc) · 3.32 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
#!/usr/bin/env bash
set -euo pipefail
REPO="https://raw.githubusercontent.com/dacrab/ghostty-config/main/config"
CFG="${XDG_CONFIG_HOME:-$HOME/.config}/ghostty"
GREEN='\033[0;32m' BLUE='\033[0;34m' RED='\033[0;31m' NC='\033[0m'
msg() { echo -e "$1$2${NC}"; }
die() { msg "$RED" "✗ $1"; exit 1; }
get_distro() {
if [[ -f /etc/os-release ]]; then
# shellcheck source=/dev/null
source /etc/os-release
echo "${ID,,}"
else
die "Unknown distro"
fi
}
install_ghostty() {
if command -v ghostty &>/dev/null; then
msg "$BLUE" "Ghostty already installed"
return
fi
msg "$BLUE" "→ Installing Ghostty..."
case "$(get_distro)" in
arch|manjaro|endeavouros)
sudo pacman -Sy --noconfirm ghostty ;;
debian)
sudo apt-get update -qq && sudo apt-get install -y -qq curl gpg
curl -fsSL https://debian.griffo.io/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/ghostty.gpg
echo "deb [signed-by=/usr/share/keyrings/ghostty.gpg] https://debian.griffo.io bookworm main" | sudo tee /etc/apt/sources.list.d/ghostty.list
sudo apt-get update -qq && sudo apt-get install -y -qq ghostty ;;
ubuntu|pop|linuxmint)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mkasberg/ghostty-ubuntu/HEAD/install.sh)" ;;
fedora)
sudo dnf copr enable -y scottames/ghostty
sudo dnf install -y ghostty ;;
opensuse*|suse*)
sudo zypper install -y ghostty ;;
alpine)
sudo apk add ghostty ;;
gentoo)
sudo emerge -av ghostty ;;
void)
sudo xbps-install -y ghostty ;;
solus)
sudo eopkg install -y ghostty ;;
*)
if command -v snap &>/dev/null; then
sudo snap install ghostty --classic
return
fi
die "Unsupported distro. Install Ghostty manually: https://ghostty.org/docs/install/binary" ;;
esac
if command -v ghostty &>/dev/null; then
msg "$GREEN" "✓ Ghostty installed"
else
die "Installation failed"
fi
}
THEMES=(
"Ash|ash" "Catppuccin Latte|catpuccin-latte" "Catppuccin Mocha|catpuccin-mocha"
"Dracula|dracula" "Everforest|everforest" "Kanagawa|kanagawa" "Matte Black|matte-black"
"Midnight|midnight" "Nord|nord" "Retro PC|retro-pc" "Rose Pine|rose-pine"
"Rose Pine Dawn|rose-pine-dark" "Snow|snow" "Solarized|solarized"
"Solarized Light|solarized-light" "Solarized Osaka|solarized-osaka"
"Synthwave '84|synthwave-84" "Tokyo Night|tokyo-night"
)
select_theme() {
echo -e "\n${BLUE}Select a theme:${NC}\n"
for i in "${!THEMES[@]}"; do printf " %2d) %s\n" $((i+1)) "${THEMES[$i]%%|*}"; done
echo -e " 0) Skip\n"
read -rp "Choice [0-${#THEMES[@]}]: " n
[[ "$n" == "0" || -z "$n" ]] && return
if ! ((n >= 1 && n <= ${#THEMES[@]})); then
msg "$RED" "Invalid"
select_theme
return
fi
file="${THEMES[$((n-1))]##*|}"
mkdir -p "$CFG"
[[ -f "$CFG/config" ]] && cp "$CFG/config" "$CFG/config.bak"
curl -fsSL "$REPO/$file" -o "$CFG/config"
msg "$GREEN" "✓ Theme applied"
}
echo -e "\n${BLUE}👻 Ghostty Setup${NC}"
install_ghostty
select_theme
echo -e "\n${GREEN}✓ Done!${NC} Run 'ghostty' to launch.\n"