#!/bin/bash

# omarchy:summary=Reset Omarchy user configs and shipped defaults in $HOME (destructive)

set -euo pipefail

if (( EUID == 0 )); then
  echo "Error: This script should not be run as root"
  exit 1
fi

echo "Resetting Armbian user configs to shipped defaults..."

# /etc/skel is the same tree useradd -m copies to seed a fresh user's $HOME.
# Replaying it over an existing user resyncs every package-shipped user
# default in one pass: .bashrc, .config/**, .local/share/applications,
# nautilus-python extensions, branding, hypr toggles, and migration markers.
# Trailing dot copies dotfiles; the shell wouldn't glob them with /etc/skel/*.
cp -af /etc/skel/. ~/
bash "${OMARCHY_PATH:-/usr/share/omarchy}/install/user/bashrc.sh"

omarchy-refresh-limine
omarchy-refresh-plymouth

if omarchy-cmd-present omarchy-nvim-refresh; then
  omarchy-nvim-refresh
elif omarchy-cmd-present omarchy-nvim-setup; then
  omarchy-nvim-setup --force
fi

# /etc/skel holds the shared defaults, so put the Snapdragon video decoding
# settings back.
omarchy-install-video-decode
