Skip to content

Commit babfafa

Browse files
committed
Split user defaults into skel seed, finalize, and resync
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.
1 parent 85da6af commit babfafa

39 files changed

Lines changed: 831 additions & 213 deletions

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The ISO owns installation orchestration. This repo ships target-side setup comma
7878

7979
- `bin/omarchy-setup-system` runs root-owned system setup during ISO finalization.
8080
- `bin/omarchy-setup-hardware` runs idempotent hardware-specific setup and is called by `omarchy-setup-system`.
81-
- `bin/omarchy-setup-user` runs user setup for the initial user and future users.
81+
- `bin/omarchy-finalize-user` runs the per-user runtime finalization (skill symlinks, xdg-user-dirs, mime defaults, `install/user/all.sh`). Shipped user defaults are seeded by `/etc/skel` from `omarchy-settings`, not by this command. `bin/omarchy-reinstall-configs` is the explicit destructive resync of those defaults into an existing user's `$HOME`.
8282
- leaf scripts under `install/` are sourced by `run_logged $OMARCHY_INSTALL/path/to/script.sh` and intentionally do not have shebangs.
8383
- avoid `exit` in sourced setup scripts unless intentionally aborting setup.
8484
- use `$OMARCHY_INSTALL` and `$OMARCHY_PATH` instead of hard-coded Omarchy paths.
@@ -171,7 +171,7 @@ To copy a default config to user config with automatic backup:
171171
omarchy-refresh-config hypr/hyprlock.conf
172172
```
173173

174-
This copies `$OMARCHY_PATH/config/hypr/hyprlock.conf` to `~/.config/hypr/hyprlock.conf`.
174+
This copies `/etc/skel/.config/hypr/hyprlock.conf` to `~/.config/hypr/hyprlock.conf`.
175175

176176
# Migrations
177177

‎bin/omarchy‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ GROUP_DESCRIPTIONS[clipboard]="Clipboard helpers"
3939
GROUP_DESCRIPTIONS[cmd]="Command and shortcut helpers"
4040
GROUP_DESCRIPTIONS[config]="System configuration helpers"
4141
GROUP_DESCRIPTIONS[debug]="Diagnostics and support logs"
42+
GROUP_DESCRIPTIONS[finalize]="Finalize user setup"
4243
GROUP_DESCRIPTIONS[default]="Default application selection"
4344
GROUP_DESCRIPTIONS[dev]="Omarchy development tools"
4445
GROUP_DESCRIPTIONS[dns]="DNS resolver configuration"

‎bin/omarchy-default-terminal‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
# omarchy:examples=omarchy default terminal ghostty | omarchy default terminal kitty
66

77
if (($# == 0)); then
8-
desktop_id=$(grep -vE '^($|#)' ~/.config/xdg-terminals.list 2>/dev/null | head -n 1)
8+
desktop_id=$(xdg-terminal-exec --print-id 2>/dev/null || true)
9+
desktop_id=${desktop_id%%:*}
910
case "$desktop_id" in
1011
Alacritty.desktop) echo "alacritty" ;;
1112
foot.desktop) echo "foot" ;;
Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
#!/bin/bash
22

3-
# omarchy:summary=Set up Omarchy for the current user (~/.config, ~/.local, etc.)
4-
# omarchy:group=setup
5-
# omarchy:examples=omarchy setup user | omarchy setup user --force
3+
# omarchy:summary=Finalize Omarchy user setup (runtime tweaks /etc/skel can't do)
4+
# omarchy:group=finalize
5+
# omarchy:examples=omarchy finalize user | omarchy finalize user --force
66

77
set -euo pipefail
88

99
usage() {
1010
cat <<USAGE
11-
Usage: omarchy setup user [--force] [--first-install]
11+
Usage: omarchy finalize user [--force] [--first-install]
1212
13-
Idempotent user-level setup: copies/symlinks defaults from \$OMARCHY_PATH
14-
into \$HOME, installs user services/session defaults, refreshes app launchers,
15-
and applies user-scoped hardware/session tweaks.
13+
Runs the per-user setup steps that /etc/skel can't seed:
14+
dev-aware skill symlinks, xdg-user-dirs + gtk bookmarks (need \$HOME),
15+
vconsole→hypr keyboard sync, default browser/mailto, and install/user/all.sh.
16+
17+
For shipped configs see /etc/skel (new users) and omarchy-reinstall-configs
18+
(existing users explicitly resyncing).
1619
1720
--first-install is used by the ISO in the target chroot. It marks shipped
18-
migrations complete for the freshly-created user and enables the first graphical
19-
login one-shot.
21+
migrations complete for the freshly-created user.
2022
21-
Idempotency marker: ~/.local/state/omarchy/setup-user.done
23+
Idempotency marker: ~/.local/state/omarchy/finalize-user.done
2224
USAGE
2325
}
2426

2527
if (( EUID == 0 )); then
26-
echo "Error: run omarchy-setup-user as the user being configured, not as root." >&2
28+
echo "Error: run omarchy-finalize-user as the user being configured, not as root." >&2
2729
exit 1
2830
fi
2931

@@ -53,11 +55,11 @@ while (($#)); do
5355
done
5456

5557
state_dir="$HOME/.local/state/omarchy"
56-
marker="$state_dir/setup-user.done"
58+
marker="$state_dir/finalize-user.done"
5759
mkdir -p "$state_dir"
5860

5961
if [[ -f $marker && $force -eq 0 ]]; then
60-
echo "User setup already complete (rerun with --force to refresh)."
62+
echo "User finalization already complete (rerun with --force to refresh)."
6163
exit 0
6264
fi
6365

@@ -79,60 +81,14 @@ else
7981
}
8082
fi
8183

82-
omarchy_user_systemctl_enable() {
83-
local unit="$1" unit_path target
84-
local -a targets=()
85-
86-
if systemctl --user enable "$unit" >/dev/null 2>&1; then
87-
return 0
88-
fi
89-
90-
# ISO chroot setup has no running user systemd manager. Enabling a user unit
91-
# is just creating the [Install] WantedBy symlinks, so do that directly.
92-
unit_path="$HOME/.config/systemd/user/$unit"
93-
if [[ -f $unit_path ]]; then
94-
mapfile -t targets < <(awk -F= '
95-
/^\[Install\]/ { in_install=1; next }
96-
/^\[/ { in_install=0 }
97-
in_install && $1 == "WantedBy" {
98-
n=split($2, values, /[[:space:]]+/)
99-
for (i = 1; i <= n; i++) if (values[i] != "") print values[i]
100-
}
101-
' "$unit_path")
102-
fi
103-
((${#targets[@]})) || targets=(default.target)
104-
105-
for target in "${targets[@]}"; do
106-
mkdir -p "$HOME/.config/systemd/user/$target.wants"
107-
ln -sfn "../$unit" "$HOME/.config/systemd/user/$target.wants/$unit"
108-
done
109-
}
110-
export -f omarchy_user_systemctl_enable
111-
112-
mkdir -p ~/.config
113-
cp -R "$OMARCHY_PATH/config/." ~/.config/
114-
cp "$OMARCHY_PATH/default/bashrc" ~/.bashrc
115-
echo '[[ -f ~/.bashrc ]] && . ~/.bashrc' > ~/.bash_profile
116-
84+
# Dev-aware skill symlinks. Cannot live in /etc/skel because OMARCHY_PATH may
85+
# point at a dev checkout (omarchy dev link) where the target differs.
11786
mkdir -p ~/.agents/skills ~/.claude/skills ~/.codex/skills ~/.pi/agent/skills
11887
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.agents/skills/omarchy
11988
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.claude/skills/omarchy
12089
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.codex/skills/omarchy
12190
ln -sfn "$OMARCHY_PATH/default/omarchy-skill" ~/.pi/agent/skills/omarchy
12291

123-
mkdir -p ~/.local/state/omarchy/toggles/hypr
124-
cp "$OMARCHY_PATH/default/hypr/toggles/flags.lua" ~/.local/state/omarchy/toggles/hypr/
125-
126-
mkdir -p "$HOME/.local/share/nautilus-python/extensions"
127-
cp "$OMARCHY_PATH/default/nautilus-python/extensions/localsend.py" \
128-
"$HOME/.local/share/nautilus-python/extensions/"
129-
cp "$OMARCHY_PATH/default/nautilus-python/extensions/transcode.py" \
130-
"$HOME/.local/share/nautilus-python/extensions/"
131-
132-
mkdir -p ~/.config/omarchy/branding
133-
cp "$OMARCHY_PATH/icon.txt" ~/.config/omarchy/branding/about.txt
134-
cp "$OMARCHY_PATH/logo.txt" ~/.config/omarchy/branding/screensaver.txt
135-
13692
mkdir -p ~/Downloads ~/Pictures ~/Videos ~/.config/gtk-3.0
13793
xdg-user-dirs-update --set TEMPLATES "$HOME"
13894
xdg-user-dirs-update --set PUBLICSHARE "$HOME"
@@ -174,4 +130,4 @@ if (( first_install )); then
174130
fi
175131

176132
touch "$marker"
177-
echo "User setup complete."
133+
echo "User finalization complete."

‎bin/omarchy-first-run‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ USAGE
1515
}
1616

1717
force=0
18-
setup_user_args=()
18+
finalize_user_args=()
1919
while (($#)); do
2020
case "$1" in
2121
--force)
2222
force=1
23-
setup_user_args+=(--force)
23+
finalize_user_args+=(--force)
2424
shift
2525
;;
2626
-h|--help)
@@ -35,7 +35,7 @@ while (($#)); do
3535
esac
3636
done
3737

38-
omarchy-setup-user "${setup_user_args[@]}" || true
38+
omarchy-finalize-user "${finalize_user_args[@]}" || true
3939

4040
state_dir=~/.local/state/omarchy
4141
mkdir -p "$state_dir"
@@ -97,8 +97,8 @@ if [[ ! -f $USER_MARKER || $force -eq 1 ]]; then
9797
run_first_run_step "install Voxtype post-update hook" \
9898
omarchy-hook-install post-update "$OMARCHY_PATH/install/user/first-run/install-voxtype.hook"
9999

100-
run_first_run_step "recover internal monitor" \
101-
bash "$OMARCHY_PATH/install/user/hardware/recover-internal-monitor.sh"
100+
run_first_run_step "enable user systemd units" \
101+
bash "$OMARCHY_PATH/install/user/first-run/enable-user-units.sh"
102102
run_first_run_step "set GNOME theme" \
103103
bash "$OMARCHY_PATH/install/user/first-run/gnome-theme.sh"
104104
run_first_run_step "set GTK primary paste" \

‎bin/omarchy-font-set‎

Lines changed: 81 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,87 @@
44
# omarchy:args=<font-name>
55
# omarchy:examples=omarchy font list | omarchy font set "CaskaydiaMono Nerd Font"
66

7-
font_name="$1"
8-
9-
if [[ -n $font_name ]]; then
10-
if fc-list | grep -iq "$font_name"; then
11-
if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
12-
sed -i "s/family = \".*\"/family = \"$font_name\"/g" ~/.config/alacritty/alacritty.toml
13-
fi
14-
15-
if [[ -f ~/.config/kitty/kitty.conf ]]; then
16-
sed -i "s/^font_family .*/font_family $font_name/g" ~/.config/kitty/kitty.conf
17-
pkill -USR1 kitty
18-
fi
19-
20-
if [[ -f ~/.config/ghostty/config ]]; then
21-
sed -i "s/font-family = \".*\"/font-family = \"$font_name\"/g" ~/.config/ghostty/config
22-
pkill -SIGUSR2 ghostty
23-
fi
24-
25-
if [[ -f ~/.config/foot/foot.ini ]]; then
26-
sed -i "s/^font=.*/font=$font_name:size=9/g" ~/.config/foot/foot.ini
27-
fi
28-
29-
# fontconfig is the canonical source of truth — the omarchy shell, Qt
30-
# apps, and anything else that resolves "monospace" all read from here.
31-
xmlstarlet ed -L \
32-
-u '//match[@target="pattern"][test/string="monospace"]/edit[@name="family"]/string' \
33-
-v "$font_name" \
34-
~/.config/fontconfig/fonts.conf
35-
36-
omarchy-restart-shell
37-
38-
if pgrep -x ghostty; then
39-
omarchy-notification-send -g  "You must restart Ghostty to see font change"
40-
fi
41-
42-
if pgrep -x foot; then
43-
omarchy-notification-send -g  "You must restart Foot to see font change"
44-
fi
45-
46-
omarchy-hook font-set "$font_name"
47-
else
48-
echo "Font '$font_name' not found."
7+
usage() {
8+
echo "Usage: omarchy-font-set <font-name>"
9+
}
10+
11+
font_name="${1:-}"
12+
omarchy_root="${OMARCHY_PATH:-/usr/share/omarchy}"
13+
14+
case "$font_name" in
15+
-h|--help)
16+
usage
17+
exit 0
18+
;;
19+
"")
20+
usage >&2
21+
exit 1
22+
;;
23+
esac
24+
25+
if ! fc-list | grep -Fqi -- "$font_name"; then
26+
echo "Font '$font_name' not found."
27+
exit 1
28+
fi
29+
30+
if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
31+
sed -i "s/family = \".*\"/family = \"$font_name\"/g" ~/.config/alacritty/alacritty.toml
32+
fi
33+
34+
if [[ -f ~/.config/kitty/kitty.conf ]]; then
35+
sed -i "s/^font_family .*/font_family $font_name/g" ~/.config/kitty/kitty.conf
36+
pkill -USR1 kitty
37+
fi
38+
39+
if [[ -f ~/.config/ghostty/config ]]; then
40+
sed -i "s/font-family = \".*\"/font-family = \"$font_name\"/g" ~/.config/ghostty/config
41+
pkill -SIGUSR2 ghostty
42+
fi
43+
44+
if [[ -f ~/.config/foot/foot.ini ]]; then
45+
sed -i "s/^font=.*/font=$font_name:size=9/g" ~/.config/foot/foot.ini
46+
fi
47+
48+
# fontconfig is the canonical source of truth — the omarchy shell, Qt apps,
49+
# and anything resolving "monospace" all read from here. The shipped default
50+
# is package-owned; create a user override only when the user changes fonts.
51+
fontconfig_file="$HOME/.config/fontconfig/fonts.conf"
52+
if [[ ! -f $fontconfig_file ]]; then
53+
fontconfig_default="$omarchy_root/default/fontconfig/conf.avail/30-omarchy.conf"
54+
if [[ ! -f $fontconfig_default ]]; then
55+
echo "Default fontconfig file not found: $fontconfig_default" >&2
4956
exit 1
5057
fi
51-
else
52-
echo "Usage: omarchy-font-set <font-name>"
58+
mkdir -p "$(dirname "$fontconfig_file")"
59+
cp "$fontconfig_default" "$fontconfig_file"
60+
fi
61+
62+
# We own the markup in 30-omarchy.conf, so the monospace block is predictable:
63+
# the <string>FAMILY</string> immediately after <string>monospace</string> is
64+
# the family we're replacing.
65+
tmp=$(mktemp)
66+
if ! awk -v new_font="$font_name" '
67+
in_mono && /<string>[^<]*<\/string>/ {
68+
sub(/<string>[^<]*<\/string>/, "<string>" new_font "</string>")
69+
in_mono = 0
70+
}
71+
/<string>monospace<\/string>/ { in_mono = 1 }
72+
{ print }
73+
' "$fontconfig_file" >"$tmp"; then
74+
rm -f "$tmp"
75+
echo "Failed to update $fontconfig_file" >&2
76+
exit 1
5377
fi
78+
mv "$tmp" "$fontconfig_file"
79+
80+
omarchy-restart-shell
81+
82+
if pgrep -x ghostty; then
83+
omarchy-notification-send -g "You must restart Ghostty to see font change"
84+
fi
85+
86+
if pgrep -x foot; then
87+
omarchy-notification-send -g "You must restart Foot to see font change"
88+
fi
89+
90+
omarchy-hook font-set "$font_name"

‎bin/omarchy-refresh-config‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
#!/bin/bash
22

3-
# omarchy:summary=Copies the named config from $OMARCHY_PATH/config/X/Y/Z -> ~/.config/X/Y/Z.
3+
# omarchy:summary=Copy a shipped user config from /etc/skel/.config into ~/.config (backs up your version).
44
# omarchy:args=<config-path>
55

6-
config_file=$1
6+
config_file=${1:-}
77

88
if [[ -z $config_file ]]; then
99
cat <<USAGE
1010
Usage: $0 [config_file]
1111
12-
Must provide a file path from the .config directory to be refreshed.
13-
To copy $OMARCHY_PATH/config/hypr/hyprland.lua to ~/.config/hypr/hyprland.lua
12+
Must provide a file path relative to .config to be refreshed.
13+
To copy /etc/skel/.config/hypr/hyprland.lua to ~/.config/hypr/hyprland.lua:
1414
1515
$0 hypr/hyprland.lua
1616
USAGE
1717
exit 1
1818
fi
1919

20-
# Backup the destination file (with timestamp) to avoid clobbering (Ex: hyprland.lua.bak.1753817951)
2120
user_config_file="${HOME}/.config/$config_file"
22-
default_config_file="$OMARCHY_PATH/config/$config_file"
21+
default_config_file="/etc/skel/.config/$config_file"
2322
backup_config_file="$user_config_file.bak.$(date +%s)"
2423

24+
if [[ ! -e $default_config_file ]]; then
25+
echo "Not a shipped user config: $config_file" >&2
26+
exit 1
27+
fi
28+
2529
mkdir -p "$(dirname "$user_config_file")"
2630

2731
if [[ -f $user_config_file ]]; then
28-
# Create preliminary backup
29-
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
30-
31-
# Replace config with new default
32-
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
32+
cp -f "$user_config_file" "$backup_config_file"
33+
cp -f "$default_config_file" "$user_config_file"
3334

34-
# Compare and delete/inform accordingly
3535
if cmp -s "$user_config_file" "$backup_config_file"; then
3636
rm "$backup_config_file"
3737
else
3838
echo -e "\e[31mReplaced $user_config_file with new Omarchy default.\nSaved backup as ${backup_config_file}.\n\n\e[32mChanges:\e[0m"
3939
diff "$user_config_file" "$backup_config_file" || true
4040
fi
4141
else
42-
# Config file did not exist already
43-
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
42+
cp -f "$default_config_file" "$user_config_file"
4443
fi

0 commit comments

Comments
 (0)