From 79ee98db6eeddcc7a994a8377acbfe6315bdf5a3 Mon Sep 17 00:00:00 2001 From: goodroot Date: Tue, 30 Sep 2025 11:25:56 -0700 Subject: [PATCH] Fix critical post_install user context issues - Run setup as actual user instead of root - Proper user detection with fallback - Fixes run.sh permissions and systemd service paths - Ensures proper group membership for /dev/uinput access --- hyprwhspr.install | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/hyprwhspr.install b/hyprwhspr.install index b3dbe01fe8fa..944e905a7dcc 100644 --- a/hyprwhspr.install +++ b/hyprwhspr.install @@ -1,6 +1,24 @@ post_install() { - # Run setup with Waybar integration enabled by default - HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup + # Detect the actual user (not root) + if [ -n "$SUDO_USER" ]; then + ACTUAL_USER="$SUDO_USER" + else + # Fallback: find first non-root user + ACTUAL_USER=$(stat -c '%U' /home 2>/dev/null | head -1 || echo "") + fi + + if [ -n "$ACTUAL_USER" ] && [ "$ACTUAL_USER" != "root" ]; then + # Run setup as the actual user + sudo -u "$ACTUAL_USER" bash -c 'HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup' || { + echo "Warning: Could not run setup as user $ACTUAL_USER. Please run manually:" + echo " hyprwhspr-setup" + echo " HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup" + } + else + echo "Warning: Could not determine user. Please run setup manually:" + echo " hyprwhspr-setup" + echo " HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup" + fi cat <<'EOF'