Allow passwordless sudo to be toggled from the toggle menu

This commit is contained in:
David Heinemeier Hansson
2026-04-29 14:58:34 +02:00
parent 12d8e001ab
commit c647edbc04
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -168,7 +168,7 @@ show_share_menu() {
}
show_toggle_menu() {
local options="󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Monitor Scaling\n Direct Boot"
local options="󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Monitor Scaling\n Direct Boot\n󰟵 Passwordless Sudo"
case $(menu "Toggle" "$options") in
*Screensaver*) omarchy-toggle-screensaver ;;
@@ -180,6 +180,7 @@ show_toggle_menu() {
*Gaps*) omarchy-hyprland-window-gaps-toggle ;;
*Scaling*) omarchy-hyprland-monitor-scaling-cycle ;;
*"Direct Boot"*) present_terminal omarchy-config-direct-boot ;;
*"Passwordless Sudo"*) present_terminal omarchy-sudo-passwordless ;;
*) back_to show_trigger_menu ;;
esac
}
+3 -1
View File
@@ -14,6 +14,8 @@ if [[ $1 && ! $1 =~ ^[0-9]+$ ]]; then
exit 1
fi
echo "Toggle passwordless sudo..."
# Safety: if the file exists but the timer doesn't (e.g. after reboot), clean up
if sudo test -f "$NOPASSWD_FILE" && ! systemctl is-active "${TIMER_NAME}.timer" &>/dev/null; then
sudo rm "$NOPASSWD_FILE"
@@ -33,7 +35,7 @@ if sudo test -f "$NOPASSWD_FILE"; then
fi
else
echo ""
echo "⚠️WARNING: This will allow ANY process running as your user to"
echo "⚠️ WARNING: This will allow ANY process running as your user to"
echo "execute ANY command as root WITHOUT a password for ${MINUTES} minutes."
echo ""
echo "This is useful for AI agents that need to run sudo commands,"