Skip to content

Instantly share code, notes, and snippets.

@mitcdh
Created February 23, 2026 19:53
Show Gist options
  • Select an option

  • Save mitcdh/8ac9c04ff6cba6be973ee01e4dde73ca to your computer and use it in GitHub Desktop.

Select an option

Save mitcdh/8ac9c04ff6cba6be973ee01e4dde73ca to your computer and use it in GitHub Desktop.
Arcy/Omarchy Backup Script
#!/bin/bash
# 1. Setup final archive name and a secure temporary staging directory
FINAL_ARCHIVE="$HOME/omarchy_backup_$(date +%Y%m%d_%H%M%S).tar.gz"
STAGE_DIR=$(mktemp -d)
# 2. Define the static config files and directories
CONFIG_PATHS=(
"$HOME/.config/hypr/bindings.conf"
"$HOME/.config/hypr/monitors.conf"
"$HOME/.config/input-remapper-2"
"/etc/1password/custom_allowed_browsers"
)
# 3. Find world-executable apps and their matching icons
APP_DIR="$HOME/.local/share/applications"
ICON_DIR="$APP_DIR/icons"
if [ -d "$APP_DIR" ]; then
while IFS= read -r -d '' app_file; do
CONFIG_PATHS+=("$app_file")
filename=$(basename -- "$app_file")
base_name="${filename%.*}"
if [ -d "$ICON_DIR" ]; then
while IFS= read -r -d '' icon_file; do
CONFIG_PATHS+=("$icon_file")
done < <(find "$ICON_DIR" -maxdepth 1 -type f -name "${base_name}.*" -print0 2>/dev/null)
fi
done < <(find "$APP_DIR" -maxdepth 1 -type f -perm -o=x -print0 2>/dev/null)
fi
echo "πŸš€ Gathering Omarchy backup files..."
# 4. Export package lists directly into the staging directory
echo "πŸ“¦ Exporting Flatpak and Package lists..."
flatpak list --app --columns=application > "$STAGE_DIR/flatpaks.txt"
pacman -Qqen > "$STAGE_DIR/native_packages.txt" 2>/dev/null
pacman -Qqem > "$STAGE_DIR/aur_packages.txt" 2>/dev/null
# 5. Archive all config files into a single tarball inside the staging directory
echo "βš™οΈ Archiving config files..."
tar -czf "$STAGE_DIR/configs.tar.gz" -P "${CONFIG_PATHS[@]}" 2>/dev/null
# 6. Bundle the staging directory contents into the final master archive
echo "πŸ—œοΈ Creating final archive..."
# The -C flag tells tar to change to the STAGE_DIR before compressing its contents (.)
tar -czf "$FINAL_ARCHIVE" -C "$STAGE_DIR" .
# 7. Clean up the temporary staging directory
rm -rf "$STAGE_DIR"
echo "βœ… Backup complete! Your entire setup is wrapped neatly in:"
echo " $FINAL_ARCHIVE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment