From bb943ae24f58b2d470aafeca9808dc85c7542ebd Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Tue, 14 Oct 2025 16:03:16 -0400 Subject: [PATCH] Update restart to prevent dbus error --- bin/omarchy-restart-walker | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-restart-walker b/bin/omarchy-restart-walker index c56be47f..7b09d351 100755 --- a/bin/omarchy-restart-walker +++ b/bin/omarchy-restart-walker @@ -1,6 +1,21 @@ #!/bin/bash pkill elephant -setsid uwsm app -- elephant & pkill walker -setsid uwsm app -- walker --gapplication-service & \ No newline at end of file + +# Detect if we're running as root (from pacman hook) +if [[ $EUID -eq 0 ]]; then + # Get the owner of this script to determine which user to run as + SCRIPT_OWNER=$(stat -c '%U' "$0") + USER_UID=$(id -u "$SCRIPT_OWNER") + + # Restart services as the script owner + systemd-run --uid="$SCRIPT_OWNER" --setenv=XDG_RUNTIME_DIR="/run/user/$USER_UID" \ + bash -c " + setsid uwsm app -- elephant & + setsid uwsm app -- walker --gapplication-service & + " +else + setsid uwsm app -- elephant & + setsid uwsm app -- walker --gapplication-service & +fi