Files
arthur-os/bin/omarchy-dev-link
T
Ryan Hughes ac452dd311 Drop the shell-expansion guard from omarchy-dev-link's conf
The previous format wrote 'export OMARCHY_PATH="${OMARCHY_PATH:-<path>}"'
to /etc/omarchy.conf, intended so install.sh's script-mode OMARCHY_PATH
could win over the dev-link value. But install.sh doesn't source
/etc/omarchy.conf (only profile.d/uwsm/bash do, all post-install), so the
guard was protecting a non-scenario.

It also caused a real bug: paths.lua parses /etc/omarchy.conf as text
and returned the literal '${OMARCHY_PATH:-<path>}' string as the
omarchy_path, breaking dev-link in Hyprland.

Switch to plain 'export OMARCHY_PATH="<path>"'. dev-link is the only
writer, and when it's active, its value should win unconditionally.
2026-06-04 18:34:35 -04:00

76 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Point Omarchy at a local checkout for live editing
# omarchy:group=dev
# omarchy:args=<path-to-checkout>
# omarchy:examples=omarchy dev link ~/Work/omarchy/omarchy-installer
set -euo pipefail
if [[ $EUID -eq 0 ]]; then
echo "Error: run omarchy-dev-link as your user, not under sudo. The script" >&2
echo " will prompt for sudo when it needs to write /etc/omarchy.conf." >&2
echo " (Invoking under sudo wipes HYPRLAND_INSTANCE_SIGNATURE so the" >&2
echo " live-session refresh can't reach hyprctl.)" >&2
exit 1
fi
if [[ $# -ne 1 || $1 == "-h" || $1 == "--help" ]]; then
cat <<USAGE
Usage: omarchy dev link <path-to-checkout>
Writes /etc/omarchy.conf so OMARCHY_PATH resolves to <path-to-checkout>
in all new shells, the Hyprland session, and Quickshell. Restarts
omarchy-shell and reloads hyprctl so changes take effect immediately.
Affects only \$OMARCHY_PATH-resolved trees: bin/, default/, shell/,
themes/, applications/, config/. Files installed at fixed system paths
(/etc/, /usr/lib/systemd/, udev rule bodies, /etc/skel after user
creation, /usr/share/plymouth) are NOT covered — for those, use
omarchy-dev-pkg-test to build and install the package from the checkout.
USAGE
exit 0
fi
target=$(realpath -e "$1" 2>/dev/null) || {
echo "Error: path does not exist: $1" >&2
exit 1
}
# Sanity: looks like an omarchy-installer checkout?
for required in bin default shell; do
if [[ ! -d "$target/$required" ]]; then
echo "Warning: $target/$required not found — does this look like an omarchy-installer checkout?" >&2
fi
done
echo "Pointing Omarchy at $target"
printf 'export OMARCHY_PATH="%s"\n' "$target" | sudo tee /etc/omarchy.conf >/dev/null
# Update the current shell so the rest of this script and anything spawned
# from it see the new path.
export OMARCHY_PATH="$target"
export PATH="$target/bin:$PATH"
# Update the live Hyprland session if one is running.
if command -v hyprctl >/dev/null 2>&1 && hyprctl version &>/dev/null; then
hyprctl setenv OMARCHY_PATH "$target" >/dev/null
hyprctl setenv PATH "$PATH" >/dev/null
echo " Updated Hyprland session env."
systemctl --user import-environment OMARCHY_PATH PATH 2>/dev/null || true
echo " Updated systemd --user env."
if pgrep -x quickshell >/dev/null 2>&1; then
omarchy-restart-shell
echo " Restarted omarchy-shell."
fi
hyprctl reload >/dev/null
echo " Reloaded Hyprland config."
fi
echo
echo "Done. Open a new shell (or restart existing ones) to pick up the new"
echo "OMARCHY_PATH. Run 'omarchy dev unlink' to restore the package install."