-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_onchange_after_39-firefox-userchrome-sync.sh.tmpl
More file actions
42 lines (37 loc) · 1.65 KB
/
Copy pathrun_onchange_after_39-firefox-userchrome-sync.sh.tmpl
File metadata and controls
42 lines (37 loc) · 1.65 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
#!/usr/bin/env bash
{{- if eq .chezmoi.os "darwin" }}
# Sync Mocha Neon userChrome.css into ALL Firefox profiles (regular + Dev Edition + Nightly).
# Firefox auto-loads userChrome.css from <profile>/chrome/ when about:config flag
# `toolkit.legacyUserProfileCustomizations.stylesheets = true` is set (one-time per profile).
#
# fingerprint: {{ output "bash" "-c" (printf "cd %q && find dot_config/firefox -type f -name 'userChrome.css' -print0 2>/dev/null | sort -z | xargs -0 sha256sum 2>/dev/null | sha256sum | cut -d' ' -f1" .chezmoi.sourceDir) }}
set -eu
SRC="$HOME/.config/firefox/userChrome.css"
if [ ! -f "$SRC" ]; then
echo "firefox-userchrome-sync: $SRC missing — skipping."
exit 0
fi
# Candidate profile roots on macOS — regular Firefox + Developer Edition + Nightly.
# macOS keeps regular + Dev Edition + Nightly profiles all under
# `~/Library/Application Support/Firefox/Profiles/` — distinguish by folder
# suffix (.default vs .dev-edition-default vs .release). The Firefox Nightly
# install uses a separate path though, so try both roots.
ROOTS=(
"$HOME/Library/Application Support/Firefox/Profiles"
"$HOME/Library/Application Support/Firefox Nightly/Profiles"
)
found_any=0
for root in "${ROOTS[@]}"; do
[ -d "$root" ] || continue
while IFS= read -r prof; do
[ -n "$prof" ] || continue
mkdir -p "$prof/chrome"
cp -f "$SRC" "$prof/chrome/userChrome.css"
echo "firefox-userchrome-sync: synced → $prof/chrome/userChrome.css"
found_any=1
done < <(find "$root" -mindepth 1 -maxdepth 1 -type d 2>/dev/null)
done
if [ "$found_any" -eq 0 ]; then
echo "firefox-userchrome-sync: no Firefox profiles found — skipping."
fi
{{- end }}