From f4e68d5bb2600ce21a0a173404dc1b489e8158e4 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Wed, 20 May 2026 18:28:16 -0400 Subject: [PATCH] Refuse omarchy-dev-{link,unlink} when invoked under sudo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the script is run under outer sudo, the environment loses HYPRLAND_INSTANCE_SIGNATURE, XDG_RUNTIME_DIR, and DBUS_SESSION_BUS_ADDRESS, so the 'hyprctl version' check silently fails and the live-session refresh (setenv / import-environment / restart shell / hyprctl reload) gets skipped. The user is left with /etc/omarchy.conf written but no session updates — confusing because the env in the current shell still shows the old value. Reject EUID=0 invocations with a clear message pointing at the right pattern: invoke as your user, the script prompts for sudo only when it needs to write /etc/omarchy.conf. --- bin/omarchy-dev-link | 8 ++++++++ bin/omarchy-dev-unlink | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/bin/omarchy-dev-link b/bin/omarchy-dev-link index 4048ba2a..1001ff43 100755 --- a/bin/omarchy-dev-link +++ b/bin/omarchy-dev-link @@ -7,6 +7,14 @@ 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 < diff --git a/bin/omarchy-dev-unlink b/bin/omarchy-dev-unlink index dbdd0f52..afcd1891 100755 --- a/bin/omarchy-dev-unlink +++ b/bin/omarchy-dev-unlink @@ -5,6 +5,12 @@ set -euo pipefail +if [[ $EUID -eq 0 ]]; then + echo "Error: run omarchy-dev-unlink as your user, not under sudo. The script" >&2 + echo " will prompt for sudo when it needs to remove /etc/omarchy.conf." >&2 + exit 1 +fi + if [[ ${1:-} == "-h" || ${1:-} == "--help" ]]; then cat <