You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If yay is performing a time-consuming building process, I often forget about it. Then I find it has encountered an error because I didn't input the password.
Is there any way to create a hook (e.g. invoke notify-send) to send a notice in this case?
The text was updated successfully, but these errors were encountered:
You can use yay -Y --sudoflags "-B" --save for a terminal bell to ring every time sudo prompts. If you want a more custom way of sending a notification or some other notifier, you can write a wrapper around sudo and use that as the sudobin config option.
Sorry forgot to give feedback. Thanks for your advice. I think the terminal bell might be helpful in common cases (though not to me).
As for the wrapper, I wrote a script and put it in /etc/pam.d/sudo but not working.
Seems that the exit code is returned by notify-send. I tried adding DBUS session variable and still no luck. I was busy then so I gave up. 😢
Oh I fixed the wrapper just now:
~ % cat /etc/pam.d/sudo
#%PAM-1.0
auth optional pam_exec.so /usr/local/bin/sudo_notify.sh
auth include system-auth
account include system-auth
session include system-auth
~ % cat /usr/local/bin/sudo_notify.sh
#!/usr/bin/env bashexport DISPLAY=:0
eval$(dbus-launch --sh-syntax)export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
# if ! [[ -f $DBUS_SESSION_BUS_ADDRESS ]]; then# export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME i3)/environ | cut -d= -f2-)# fi
notify-send "Sudo Alert""Please enter your password to proceed."
If yay is performing a time-consuming building process, I often forget about it. Then I find it has encountered an error because I didn't input the password.
Is there any way to create a hook (e.g. invoke
notify-send
) to send a notice in this case?The text was updated successfully, but these errors were encountered: