Make dev unlink reset Omarchy path defensively
This commit is contained in:
+20
-2
@@ -3,26 +3,44 @@
|
||||
# omarchy:summary=Show the current Omarchy dev-link state
|
||||
# omarchy:group=dev
|
||||
|
||||
default_target="/usr/share/omarchy"
|
||||
configured="$default_target"
|
||||
conf_present=0
|
||||
linked=0
|
||||
|
||||
if [[ -f /etc/omarchy.conf ]]; then
|
||||
conf_present=1
|
||||
configured=$(
|
||||
OMARCHY_PATH=
|
||||
# shellcheck disable=SC1091
|
||||
. /etc/omarchy.conf
|
||||
printf '%s' "${OMARCHY_PATH:-<empty>}"
|
||||
)
|
||||
if [[ $configured != "$default_target" ]]; then
|
||||
linked=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( linked )); then
|
||||
echo "dev-link: ACTIVE"
|
||||
echo " /etc/omarchy.conf -> OMARCHY_PATH=$configured"
|
||||
else
|
||||
configured="/usr/share/omarchy (default)"
|
||||
echo "dev-link: inactive"
|
||||
if (( conf_present )); then
|
||||
echo " /etc/omarchy.conf -> OMARCHY_PATH=$configured (default guard)"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo " current shell: OMARCHY_PATH=${OMARCHY_PATH:-<unset>}"
|
||||
|
||||
if [[ -f /etc/omarchy.conf && "${OMARCHY_PATH:-}" != "$configured" ]]; then
|
||||
if (( linked )) && [[ ${OMARCHY_PATH:-} != "$configured" ]]; then
|
||||
echo
|
||||
echo "Note: this shell predates dev-link. Open a new shell to pick up the change,"
|
||||
echo "or 'export OMARCHY_PATH=$configured' to update just this shell."
|
||||
elif (( ! linked )) && [[ ${OMARCHY_PATH:-$default_target} != "$default_target" ]]; then
|
||||
echo
|
||||
echo "Note: no dev-link is configured, but this shell still has a stale OMARCHY_PATH."
|
||||
echo "Open a new shell or run 'export OMARCHY_PATH=$default_target'."
|
||||
fi
|
||||
|
||||
if command -v hyprctl >/dev/null 2>&1 && hyprctl version &>/dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user