-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (85 loc) · 4.39 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·94 lines (85 loc) · 4.39 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
#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
stamp="$(date +%Y%m%d-%H%M%S-%N)"
backup_dir="$HOME/.local/state/omarchy-customize/backups/$stamp"
command_center="$HOME/.config/quickshell/command-center"
theme_dir="$HOME/.config/omarchy/themes/nvimgelion"
settings_backup=""
font_dir="$HOME/.local/share/fonts"
for command in qs alacritty fastfetch jq hyprctl uwsm omarchy fc-cache; do
command -v "$command" >/dev/null || {
printf 'Missing dependency: %s\n' "$command" >&2
exit 1
}
done
mkdir -p "$backup_dir" "$HOME/.config/quickshell" "$HOME/.config/omarchy/themes" "$HOME/.config/omarchy/branding" "$HOME/.config/hypr" "$HOME/.config/gtk-3.0" "$HOME/.config/gtk-4.0" "$font_dir"
[[ ! -e "$command_center" ]] || cp -a "$command_center" "$backup_dir/command-center"
[[ ! -e "$command_center/settings.json" ]] || settings_backup="$backup_dir/command-center/settings.json"
[[ ! -e "$theme_dir" ]] || cp -a "$theme_dir" "$backup_dir/nvimgelion"
for file in autostart.conf looknfeel.conf bindings.conf hypridle.conf hyprlock.conf; do
[[ ! -e "$HOME/.config/hypr/$file" ]] || cp -a "$HOME/.config/hypr/$file" "$backup_dir/$file"
done
for gtk in gtk-3.0/gtk.css gtk-4.0/gtk.css; do
[[ ! -e "$HOME/.config/$gtk" ]] || {
mkdir -p "$backup_dir/$(dirname "$gtk")"
cp -a "$HOME/.config/$gtk" "$backup_dir/$gtk"
}
done
[[ ! -e "$HOME/.config/omarchy/branding/screensaver.txt" ]] || cp -a "$HOME/.config/omarchy/branding/screensaver.txt" "$backup_dir/screensaver.txt"
for font in evangelion-regular.otf evangelion-italic.otf; do
[[ ! -e "$font_dir/$font" ]] || cp -a "$font_dir/$font" "$backup_dir/$font"
done
# Fontconfig scans font binaries regardless of a cosmetic `.disabled` suffix.
# Move the old trial build out of the font directory so it cannot steal the
# shared `Evangelion` family alias from the bundled complete face.
for trial_font in EVANGELION-TRIAL.otf EVANGELION-TRIAL.otf.disabled; do
[[ ! -e "$font_dir/$trial_font" ]] || mv "$font_dir/$trial_font" "$backup_dir/$trial_font"
done
mkdir -p "$command_center" "$theme_dir"
cp -a "$repo_dir/config/quickshell/command-center/." "$command_center/"
mkdir -p "$command_center/fonts"
install -m 0644 "$repo_dir/fonts/evangelion-regular.otf" "$command_center/fonts/evangelion-regular.otf"
install -m 0644 "$repo_dir/fonts/evangelion-italic.otf" "$command_center/fonts/evangelion-italic.otf"
cp -a "$repo_dir/config/omarchy/themes/nvimgelion/." "$theme_dir/"
[[ -z "$settings_backup" ]] || cp -a "$settings_backup" "$command_center/settings.json"
cp -a "$repo_dir/config/omarchy/branding/screensaver.txt" "$HOME/.config/omarchy/branding/screensaver.txt"
cp -a "$repo_dir/config/gtk-3.0/gtk.css" "$HOME/.config/gtk-3.0/gtk.css"
cp -a "$repo_dir/config/gtk-4.0/gtk.css" "$HOME/.config/gtk-4.0/gtk.css"
cp -a "$repo_dir/config/hypr/hypridle.conf" "$HOME/.config/hypr/hypridle.conf"
cp -a "$repo_dir/config/hypr/hyprlock.conf" "$HOME/.config/hypr/hyprlock.conf"
install -m 0644 "$repo_dir/fonts/evangelion-regular.otf" "$font_dir/evangelion-regular.otf"
install -m 0644 "$repo_dir/fonts/evangelion-italic.otf" "$font_dir/evangelion-italic.otf"
fc-cache -f "$font_dir" >/dev/null
chmod 755 "$command_center"/*.sh "$command_center"/*.py
replace_block() {
local target="$1" snippet="$2" temporary
temporary="$(mktemp)"
[[ -e "$target" ]] || : >"$target"
awk '
/^# >>> omarchy-customize >>>$/ { skip=1; next }
/^# <<< omarchy-customize <<<$/{ skip=0; next }
!skip { print }
' "$target" >"$temporary"
{
cat "$temporary"
printf '\n# >>> omarchy-customize >>>\n'
cat "$snippet"
printf '# <<< omarchy-customize <<<\n'
} >"$target"
}
replace_block "$HOME/.config/hypr/autostart.conf" "$repo_dir/hypr/autostart.snippet.conf"
replace_block "$HOME/.config/hypr/looknfeel.conf" "$repo_dir/hypr/looknfeel.snippet.conf"
replace_block "$HOME/.config/hypr/bindings.conf" "$repo_dir/hypr/bindings.snippet.conf"
omarchy theme set Nvimgelion
hyprctl reload
errors="$(hyprctl configerrors)"
if [[ -n "$errors" ]]; then
printf '%s\n' "$errors" >&2
printf 'Hyprland reported configuration errors. Backups: %s\n' "$backup_dir" >&2
exit 1
fi
omarchy restart mako >/dev/null 2>&1 || true
omarchy restart hypridle >/dev/null 2>&1 || true
printf 'Installed. Backup: %s\n' "$backup_dir"
printf 'Log out and back in to start every dashboard service automatically.\n'