Reorganizes Omarchy 4 around three layers for populating $HOME:
Seed: omarchy-settings ships defaults to /etc/skel; useradd -m
copies them on user creation
Finalize: omarchy-finalize-user (renamed from omarchy-setup-user)
handles only the runtime tweaks /etc/skel can't do — skill
symlinks, xdg-user-dirs, default browser/mailto, vconsole→hypr
keyboard sync, and install/user/all.sh
Resync: omarchy-reinstall-configs is the explicit, destructive
resync of /etc/skel into an existing user's $HOME
Package-owned files move out of config/ into default/, where the
omarchy-settings PKGBUILD installs them to real system paths:
config/environment.d/fcitx.conf -> /usr/lib/environment.d/
config/fontconfig/fonts.conf -> /usr/share/fontconfig/conf.avail/
config/mimeapps.list -> /usr/share/applications/
config/omarchy.ttf -> /usr/share/fonts/omarchy/
config/systemd/user/*.service -> /usr/lib/systemd/user/
config/uwsm/default -> /usr/share/omarchy/default/uwsm/
config/uwsm/env -> /usr/share/uwsm/env.d/10-omarchy
config/xdg-terminals.list -> /usr/share/xdg-terminal-exec/
omarchy-upgrade-to-4 grows a 'retire' action (renamed from 'move' to
clarify nothing is copied — the system path is owned by the new package
once the user's hash-matched ~/.config copy is removed). Mismatched
copies are kept as backups so user overrides survive the upgrade.
Other simplifications:
- Single env bootstrap at default/bash/env-bootstrap sourced by
/etc/profile.d/omarchy.sh, /etc/skel/.bashrc,
/usr/share/uwsm/env.d/10-omarchy, and default/bash/envs. PATH
prepend only in dev-link mode (production uses /usr/bin/omarchy-*).
- omarchy-refresh-config reads from /etc/skel/.config so refresh
means 'snap to skel'.
- omarchy-reinstall-configs collapses to 'cp -af /etc/skel/. ~/'
plus limine/plymouth/nvim refresh.
- omarchy-font-set uses awk against our own 30-omarchy.conf instead
of xmlstarlet; xmlstarlet dropped from omarchy-base.packages.
- Defer user systemd enables (bt-agent, sleep-lock,
recover-internal-monitor) to first-run via
install/user/first-run/enable-user-units.sh; delete
omarchy-user-systemctl-enable and the per-hardware install
scripts that called it.
- Wireplumber bluetooth-a2dp-autoconnect.conf moves to config/ so
/etc/skel ships it; install/user/hardware/bluetooth.sh deleted.
- Default terminal switched to foot.desktop.
- docs/file-layout.md documents the three-layer model and the
build-time repo→path map.
134 lines
4.0 KiB
Bash
Executable File
134 lines
4.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Finalize Omarchy user setup (runtime tweaks /etc/skel can't do)
|
|
# omarchy:group=finalize
|
|
# omarchy:examples=omarchy finalize user | omarchy finalize user --force
|
|
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
cat <<USAGE
|
|
Usage: omarchy finalize user [--force] [--first-install]
|
|
|
|
Runs the per-user setup steps that /etc/skel can't seed:
|
|
dev-aware skill symlinks, xdg-user-dirs + gtk bookmarks (need \$HOME),
|
|
vconsole→hypr keyboard sync, default browser/mailto, and install/user/all.sh.
|
|
|
|
For shipped configs see /etc/skel (new users) and omarchy-reinstall-configs
|
|
(existing users explicitly resyncing).
|
|
|
|
--first-install is used by the ISO in the target chroot. It marks shipped
|
|
migrations complete for the freshly-created user.
|
|
|
|
Idempotency marker: ~/.local/state/omarchy/finalize-user.done
|
|
USAGE
|
|
}
|
|
|
|
if (( EUID == 0 )); then
|
|
echo "Error: run omarchy-finalize-user as the user being configured, not as root." >&2
|
|
exit 1
|
|
fi
|
|
|
|
force=0
|
|
first_install=0
|
|
while (($#)); do
|
|
case "$1" in
|
|
--force)
|
|
force=1
|
|
shift
|
|
;;
|
|
--first-install)
|
|
first_install=1
|
|
force=1
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
state_dir="$HOME/.local/state/omarchy"
|
|
marker="$state_dir/finalize-user.done"
|
|
mkdir -p "$state_dir"
|
|
|
|
if [[ -f $marker && $force -eq 0 ]]; then
|
|
echo "User finalization already complete (rerun with --force to refresh)."
|
|
exit 0
|
|
fi
|
|
|
|
export OMARCHY_PATH="${OMARCHY_PATH:-/usr/share/omarchy}"
|
|
export OMARCHY_INSTALL="${OMARCHY_INSTALL:-$OMARCHY_PATH/install}"
|
|
export OMARCHY_SETUP_CONTEXT="${OMARCHY_SETUP_CONTEXT:-runtime}"
|
|
export PATH="$OMARCHY_PATH/bin:$PATH"
|
|
|
|
if (( first_install )); then
|
|
export OMARCHY_SETUP_CONTEXT=iso-chroot
|
|
fi
|
|
|
|
if [[ -n ${OMARCHY_INSTALL_LOG_FILE:-} && -f $OMARCHY_INSTALL/helpers/logging.sh ]]; then
|
|
source "$OMARCHY_INSTALL/helpers/logging.sh"
|
|
else
|
|
run_logged() {
|
|
local script="$1"
|
|
bash -eE -c 'source "$1"' bash "$script"
|
|
}
|
|
fi
|
|
|
|
# Dev-aware skill symlinks. Cannot live in /etc/skel because OMARCHY_PATH may
|
|
# point at a dev checkout (omarchy dev link) where the target differs.
|
|
mkdir -p ~/.agents/skills ~/.claude/skills ~/.codex/skills ~/.pi/agent/skills
|
|
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.agents/skills/omarchy
|
|
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.claude/skills/omarchy
|
|
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.codex/skills/omarchy
|
|
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.pi/agent/skills/omarchy
|
|
|
|
mkdir -p ~/Downloads ~/Pictures ~/Videos ~/.config/gtk-3.0
|
|
xdg-user-dirs-update --set TEMPLATES "$HOME"
|
|
xdg-user-dirs-update --set PUBLICSHARE "$HOME"
|
|
xdg-user-dirs-update --set DESKTOP "$HOME"
|
|
rmdir ~/Templates ~/Public ~/Desktop 2>/dev/null || true
|
|
touch ~/.config/gtk-3.0/bookmarks
|
|
for dir in Downloads Projects Pictures Videos; do
|
|
bookmark="file://$HOME/$dir $dir"
|
|
grep -qxF "$bookmark" ~/.config/gtk-3.0/bookmarks || echo "$bookmark" >>~/.config/gtk-3.0/bookmarks
|
|
done
|
|
|
|
conf=/etc/vconsole.conf
|
|
hyprlua="$HOME/.config/hypr/input.lua"
|
|
if [[ -f $conf && -f $hyprlua ]]; then
|
|
sed -i '/^[[:space:]]*kb_layout[[:space:]]*=/d' "$hyprlua"
|
|
sed -i '/^[[:space:]]*kb_variant[[:space:]]*=/d' "$hyprlua"
|
|
|
|
if grep -q '^XKBLAYOUT=' "$conf"; then
|
|
layout=$(grep '^XKBLAYOUT=' "$conf" | cut -d= -f2 | tr -d '"')
|
|
sed -i "/^[[:space:]]*kb_options *=/i\ kb_layout = \"$layout\"," "$hyprlua"
|
|
fi
|
|
if grep -q '^XKBVARIANT=' "$conf"; then
|
|
variant=$(grep '^XKBVARIANT=' "$conf" | cut -d= -f2 | tr -d '"')
|
|
sed -i "/^[[:space:]]*kb_options *=/i\ kb_variant = \"$variant\"," "$hyprlua"
|
|
fi
|
|
fi
|
|
|
|
source "$OMARCHY_INSTALL/user/all.sh"
|
|
|
|
omarchy-refresh-applications
|
|
xdg-settings set default-web-browser chromium.desktop
|
|
xdg-mime default HEY.desktop x-scheme-handler/mailto
|
|
|
|
if (( first_install )); then
|
|
mkdir -p "$state_dir/migrations"
|
|
for migration in "$OMARCHY_PATH"/migrations/*.sh; do
|
|
[[ -f $migration ]] && touch "$state_dir/migrations/$(basename "$migration")"
|
|
done
|
|
fi
|
|
|
|
touch "$marker"
|
|
echo "User finalization complete."
|