2025-07-30 10:12:37 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This script deploys ~/.local/share/omarchy/config/X/Y/Z -> ~/.config/X/Y/Z
|
|
|
|
config_file=$1
|
|
|
|
|
|
|
|
if [[ -z "$config_file" ]]; then
|
2025-08-02 13:54:44 +02:00
|
|
|
cat <<USAGE
|
2025-07-30 10:12:37 -04:00
|
|
|
Usage: $0 [config_file]
|
|
|
|
|
|
|
|
Must provide a file path from the .config directory to be refreshed.
|
|
|
|
To copy ~/.local/share/omarchy/config/hypr/hyprlock.conf to ~/.config/hypr/hyprlock.conf
|
|
|
|
|
|
|
|
$0 hypr/hyprlock.conf
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Backup the destination file (with timestamp) to avoid clobbering (Ex: hyprlock.conf.bak.1753817951)
|
2025-08-02 13:54:44 +02:00
|
|
|
user_config_file="${HOME}/.config/$config_file"
|
|
|
|
default_config_file="${HOME}/.local/share/omarchy/config/$config_file"
|
|
|
|
backup_config_file="$user_config_file.bak.$(date +%s)"
|
2025-07-30 10:12:37 -04:00
|
|
|
|
2025-08-02 13:54:44 +02:00
|
|
|
# Create preliminary backup
|
|
|
|
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
|
|
|
|
|
|
|
|
# Replace config with new default
|
|
|
|
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
|
2025-07-30 10:12:37 -04:00
|
|
|
|
|
|
|
# Compare and delete/inform accordingly
|
2025-08-02 13:54:44 +02:00
|
|
|
if cmp -s "$user_config_file" "$backup_config_file"; then
|
|
|
|
rm "$backup_config_file"
|
2025-07-30 10:12:37 -04:00
|
|
|
else
|
2025-08-02 13:54:44 +02:00
|
|
|
echo -e "\e[31mReplaced $user_config_file with new Omarchy default.\nSaved backup as ${backup_config_file}.\n\n\e[32mChanges:\e[0m"
|
|
|
|
diff "$user_config_file" "$backup_config_file"
|
2025-07-30 10:12:37 -04:00
|
|
|
fi
|