-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·139 lines (118 loc) · 6.22 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·139 lines (118 loc) · 6.22 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bash
# ═══════════════════════════════════════════════════════════════════
# candyfactory-cosmic · installer
#
# Installs the CandyFactory Cotton Candy Parlor theme into the
# current user's COSMIC config. Safe to re-run.
#
# ./install.sh install everything
# ./install.sh --uninstall remove everything we wrote
# ./install.sh --dry-run print what would happen
#
# Tested against Pop!_OS 24.04 LTS (COSMIC 1.0).
# ═══════════════════════════════════════════════════════════════════
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CFG="${XDG_CONFIG_HOME:-$HOME/.config}/cosmic"
DRY=0
UNINSTALL=0
for arg in "$@"; do
case "$arg" in
--dry-run) DRY=1 ;;
--uninstall) UNINSTALL=1 ;;
-h|--help)
sed -n '2,15p' "$0"; exit 0 ;;
*) echo "unknown arg: $arg" >&2; exit 2 ;;
esac
done
say() { printf ' \033[1;35m▸\033[0m %s\n' "$*"; }
note() { printf ' \033[2m· %s\033[0m\n' "$*"; }
oops() { printf ' \033[1;31m✗\033[0m %s\n' "$*" >&2; }
die() { oops "$*"; exit 1; }
run() { if [ "$DRY" = "1" ]; then note "would: $*"; else "$@"; fi; }
banner() {
cat <<'EOF'
╭──────────────────────────────────────────────╮
│ 🍭 CandyFactory · Cotton Candy Parlor │
│ for POP!_OS 24.04 · COSMIC │
╰──────────────────────────────────────────────╯
EOF
}
banner
# ── sources ────────────────────────────────────────────────────────
# Every file we copy out of themes/. Named once here so the precheck
# and the copy block can never drift apart.
THEMES="$HERE/themes"
DARK_SRC="$THEMES/candyfactory-bonfire-dark.ron"
LIGHT_SRC="$THEMES/candyfactory-parlor-light.ron"
TERM_SRC="$THEMES/candyfactory-term-bonfire.ron"
ACCENT_DARK_SRC="$THEMES/candyfactory-accent-palette-dark"
ACCENT_LIGHT_SRC="$THEMES/candyfactory-accent-palette-light"
# ── targets ────────────────────────────────────────────────────────
THEME_DARK_DIR="$CFG/com.system76.CosmicTheme.Dark/v1"
THEME_LIGHT_DIR="$CFG/com.system76.CosmicTheme.Light/v1"
TERM_DIR="$CFG/com.system76.CosmicTerm/v1/color_schemes"
SETTINGS_DIR="$CFG/com.system76.CosmicSettings/v1"
DARK_TARGET="$THEME_DARK_DIR/CandyFactory-Bonfire"
LIGHT_TARGET="$THEME_LIGHT_DIR/CandyFactory-Parlor"
TERM_TARGET="$TERM_DIR/CandyFactory-Bonfire.ron"
ACCENT_DARK_TARGET="$SETTINGS_DIR/accent_palette_dark"
ACCENT_LIGHT_TARGET="$SETTINGS_DIR/accent_palette_light"
# ── uninstall ──────────────────────────────────────────────────────
if [ "$UNINSTALL" = "1" ]; then
say "Uninstalling CandyFactory theme…"
run rm -f "$DARK_TARGET" "$LIGHT_TARGET" "$TERM_TARGET" \
"$ACCENT_DARK_TARGET" "$ACCENT_LIGHT_TARGET"
say "Done. Run 'cosmic-settings' to pick a different appearance."
exit 0
fi
# ── precheck ───────────────────────────────────────────────────────
if ! command -v cosmic-settings >/dev/null 2>&1; then
note "Warning: 'cosmic-settings' not found on PATH."
note " Is this Pop!_OS 24.04 with COSMIC installed?"
fi
# Assert every source exists BEFORE we copy anything. Without this, a
# missing or renamed source aborts mid-run under `set -e` — leaving a
# half-installed theme set with no cleanup — and a --dry-run would echo
# all five "would: cp" lines and exit 0, falsely reporting success.
# Fail fast in BOTH modes, naming each missing file.
missing=0
for src in "$DARK_SRC" "$LIGHT_SRC" "$TERM_SRC" \
"$ACCENT_DARK_SRC" "$ACCENT_LIGHT_SRC"; do
if [ ! -f "$src" ]; then
oops "Missing source: $src"
missing=$((missing + 1))
fi
done
if [ "$missing" -gt 0 ]; then
die "$missing source file(s) missing — nothing installed. Run from the repo root with themes/ intact."
fi
# ── install themes ─────────────────────────────────────────────────
say "Installing Bonfire (dark) theme → $DARK_TARGET"
run mkdir -p "$THEME_DARK_DIR"
run cp -f "$DARK_SRC" "$DARK_TARGET"
say "Installing Parlor (light) theme → $LIGHT_TARGET"
run mkdir -p "$THEME_LIGHT_DIR"
run cp -f "$LIGHT_SRC" "$LIGHT_TARGET"
say "Installing cosmic-term color scheme → $TERM_TARGET"
run mkdir -p "$TERM_DIR"
run cp -f "$TERM_SRC" "$TERM_TARGET"
say "Installing accent palette (dark) → $ACCENT_DARK_TARGET"
run mkdir -p "$SETTINGS_DIR"
run cp -f "$ACCENT_DARK_SRC" "$ACCENT_DARK_TARGET"
say "Installing accent palette (light) → $ACCENT_LIGHT_TARGET"
run mkdir -p "$SETTINGS_DIR"
run cp -f "$ACCENT_LIGHT_SRC" "$ACCENT_LIGHT_TARGET"
# ── done ───────────────────────────────────────────────────────────
cat <<'EOF'
╭──────────────────────────────────────────────╮
│ ✓ Sweets, baking. Stay close. │
╰──────────────────────────────────────────────╯
Next steps:
1) Open Settings → Desktop → Appearance
2) Pick CandyFactory-Bonfire (dark) or
CandyFactory-Parlor (light)
3) Open cosmic-term → View → Color schemes
and pick "CandyFactory Bonfire".
To revert: ./install.sh --uninstall
EOF