From 926c0cbdeff6d90f072d92aee88a062a2d084c8a Mon Sep 17 00:00:00 2001 From: Marcelo Barros Date: Sat, 15 Jan 2022 10:23:47 -0300 Subject: [PATCH] Don't ask for password when sudo is allowed --- systemd-manager@hardpixel.eu/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd-manager@hardpixel.eu/utils.js b/systemd-manager@hardpixel.eu/utils.js index 1a3f2a8..80844c3 100644 --- a/systemd-manager@hardpixel.eu/utils.js +++ b/systemd-manager@hardpixel.eu/utils.js @@ -52,7 +52,7 @@ function runServiceAction(method, action, type, service) { let cmd = `systemctl ${action} ${service} --${type}` if (method == 0 && type == 'system') { - cmd = `pkexec --user root ${cmd}` + cmd = `(sudo -V && sudo -n ${cmd}) || pkexec --user root ${cmd}` } GLib.spawn_command_line_async(`sh -c "${cmd}; exit"`)