Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·111 lines (88 loc) · 2.68 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·111 lines (88 loc) · 2.68 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
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env bash
#
# dark-2026 -- Ghostty installer
#
# Copies code-2026.conf and light-2026.conf into Ghostty's themes directory.
#
# ./install.sh install both themes (backs up any existing copies)
# ./install.sh --uninstall remove the installed themes
# ./install.sh --help usage
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
THEME_DIR="${GHOSTTY_THEME_DIR:-$HOME/.config/ghostty/themes}"
THEMES=("code-2026" "light-2026")
bold=''; dim=''; red=''; green=''; yellow=''; reset=''
if [ -t 1 ]; then
bold=$'\033[1m'; dim=$'\033[2m'; red=$'\033[31m'
green=$'\033[32m'; yellow=$'\033[33m'; reset=$'\033[0m'
fi
info() { printf '%s\n' "$*"; }
ok() { printf '%s✓%s %s\n' "$green" "$reset" "$*"; }
warn() { printf '%s!%s %s\n' "$yellow" "$reset" "$*" >&2; }
die() { printf '%s✗%s %s\n' "$red" "$reset" "$*" >&2; exit 1; }
usage() {
cat <<EOF
${bold}dark-2026 -- Ghostty installer${reset}
Usage: install.sh [options]
Options:
-u, --uninstall Remove the installed themes (and nothing else)
-f, --force Overwrite existing themes without keeping backups
-h, --help Show this message
Environment:
GHOSTTY_THEME_DIR Install location
${dim}(default: ~/.config/ghostty/themes)${reset}
EOF
}
action='install'
force=0
while [ $# -gt 0 ]; do
case "$1" in
-u|--uninstall) action='uninstall' ;;
-f|--force) force=1 ;;
-h|--help) usage; exit 0 ;;
*) usage >&2; die "unknown option: $1" ;;
esac
shift
done
if [ "$action" = 'uninstall' ]; then
found=0
for name in "${THEMES[@]}"; do
target="$THEME_DIR/$name"
if [ -e "$target" ]; then
rm -f "$target"
ok "Removed $target"
found=1
fi
done
if [ "$found" -eq 1 ]; then
info "Pick another theme in ~/.config/ghostty/config:"
info " theme = <theme-name>"
else
info "Nothing to do -- no dark-2026 themes are installed."
fi
exit 0
fi
mkdir -p "$THEME_DIR"
for name in "${THEMES[@]}"; do
source="$SCRIPT_DIR/themes/$name.conf"
target="$THEME_DIR/$name"
[ -f "$source" ] || die "theme file not found: $source"
if [ -e "$target" ]; then
if [ "$force" -eq 1 ]; then
rm -f "$target"
else
backup="$target.$(date +%Y%m%d%H%M%S).bak"
mv "$target" "$backup"
warn "Existing theme moved to $(basename "$backup")"
fi
fi
cp "$source" "$target"
ok "Installed $target"
done
cat <<EOF
Next, set the theme in ${bold}~/.config/ghostty/config${reset}:
${dim}theme = code-2026${reset}
${dim}Or for the light variant:${reset}
${dim}theme = light-2026${reset}
${dim}Reload Ghostty or restart it for the changes to take effect.${reset}
EOF