From 62ada9e9ec6f41b3dee2939c764a834e6bf3a23c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 22 Jun 2026 18:30:16 +0200 Subject: [PATCH] Need to copy configs from $OMARCHY_PATH so it'll work with the dev link --- AGENTS.md | 2 +- bin/omarchy-refresh-config | 6 ++--- default/omarchy-skill/SKILL.md | 6 ++--- test/shell.d/refresh-config-test.sh | 40 +++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 test/shell.d/refresh-config-test.sh diff --git a/AGENTS.md b/AGENTS.md index 6abcc44b..e5eefa4d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -171,7 +171,7 @@ To copy a default config to user config with automatic backup: omarchy-refresh-config hypr/hyprlock.conf ``` -This copies `/etc/skel/.config/hypr/hyprlock.conf` to `~/.config/hypr/hyprlock.conf`. +This copies `$OMARCHY_PATH/config/hypr/hyprlock.conf` to `~/.config/hypr/hyprlock.conf`. # Migrations diff --git a/bin/omarchy-refresh-config b/bin/omarchy-refresh-config index a4dbe6b3..f4d0f50b 100755 --- a/bin/omarchy-refresh-config +++ b/bin/omarchy-refresh-config @@ -1,6 +1,6 @@ #!/bin/bash -# omarchy:summary=Copy a shipped user config from /etc/skel/.config into ~/.config (backs up your version). +# omarchy:summary=Copy a shipped user config from $OMARCHY_PATH/config into ~/.config (backs up your version). # omarchy:args= config_file=${1:-} @@ -10,7 +10,7 @@ if [[ -z $config_file ]]; then Usage: $0 [config_file] Must provide a file path relative to .config to be refreshed. - To copy /etc/skel/.config/hypr/hyprland.lua to ~/.config/hypr/hyprland.lua: + To copy $OMARCHY_PATH/config/hypr/hyprland.lua to ~/.config/hypr/hyprland.lua: $0 hypr/hyprland.lua USAGE @@ -18,7 +18,7 @@ USAGE fi user_config_file="${HOME}/.config/$config_file" -default_config_file="/etc/skel/.config/$config_file" +default_config_file="$OMARCHY_PATH/config/$config_file" backup_config_file="$user_config_file.bak.$(date +%s)" if [[ ! -e $default_config_file ]]; then diff --git a/default/omarchy-skill/SKILL.md b/default/omarchy-skill/SKILL.md index c992328e..88368202 100644 --- a/default/omarchy-skill/SKILL.md +++ b/default/omarchy-skill/SKILL.md @@ -58,7 +58,7 @@ This directory contains Omarchy's source files managed by git. Any changes will **Reading `/usr/share/omarchy/` is SAFE and useful** - do it freely to: - Understand how omarchy commands work: `omarchy theme set --help` or `cat $(which omarchy-theme-set)` -- See default configs before customizing: `cat /usr/share/omarchy/config/omarchy/shell.json` +- See default configs before customizing: `cat "$OMARCHY_PATH/config/omarchy/shell.json"` - Check stock theme files to copy for customization - Reference default hyprland settings: `cat /usr/share/omarchy/default/hypr/*` @@ -154,7 +154,7 @@ inside a single long-running Quickshell process (`omarchy-shell`). ``` ~/.config/omarchy/shell.json # User overrides: bar.position, bar.layout, plugins[] -/usr/share/omarchy/config/omarchy/shell.json # Canonical defaults +$OMARCHY_PATH/config/omarchy/shell.json # Canonical defaults ``` The shell hot-reloads `shell.json` on save — no restart needed for layout @@ -243,7 +243,7 @@ omarchy refresh hyprland # The refresh command: # 1. Backs up current config with timestamp -# 2. Copies default from /usr/share/omarchy/config/ +# 2. Copies default from $OMARCHY_PATH/config/ # 3. Restarts the component ``` diff --git a/test/shell.d/refresh-config-test.sh b/test/shell.d/refresh-config-test.sh new file mode 100644 index 00000000..0fc5c742 --- /dev/null +++ b/test/shell.d/refresh-config-test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh" + +tmpdir=$(mktemp -d) +trap 'rm -rf "$tmpdir"' EXIT + +home="$tmpdir/home" +omarchy_path="$tmpdir/omarchy" + +mkdir -p "$home/.config/hypr" "$omarchy_path/config/hypr" + +cat >"$omarchy_path/config/hypr/bindings.lua" <<'EOF' +-- refreshed from OMARCHY_PATH +EOF + +cat >"$home/.config/hypr/bindings.lua" <<'EOF' +-- existing user config +EOF + +HOME="$home" OMARCHY_PATH="$omarchy_path" "$ROOT/bin/omarchy-refresh-config" hypr/bindings.lua >/dev/null + +cmp -s "$omarchy_path/config/hypr/bindings.lua" "$home/.config/hypr/bindings.lua" || + fail "refresh-config copies from OMARCHY_PATH/config" + +backup=$(find "$home/.config/hypr" -name 'bindings.lua.bak.*' -print -quit) +[[ -n $backup ]] || fail "refresh-config backs up replaced user config" +grep -Fq -- '-- existing user config' "$backup" || + fail "refresh-config backup contains previous user config" + +pass "refresh-config copies from OMARCHY_PATH/config and backs up existing files" + +if HOME="$home" OMARCHY_PATH="$omarchy_path" "$ROOT/bin/omarchy-refresh-config" hypr/missing.lua >"$tmpdir/out" 2>"$tmpdir/err"; then + fail "refresh-config rejects configs missing from OMARCHY_PATH/config" +fi + +grep -Fq 'Not a shipped user config: hypr/missing.lua' "$tmpdir/err" || + fail "refresh-config reports missing shipped config" + +pass "refresh-config validates against OMARCHY_PATH/config"