Jump to content

Low power mode workflow


Recommended Posts

6 hours ago, skynet01 said:

so implementation into workflow should be easy I just never made one.

 

Probably not so straightforward because it uses sudo, which means you have to enter your password to run the command.

 

The simple solution is to use AppleScript’s do shell script "..." with administrator privileges, which will pop up the standard macOS “Enter your password” dialog. (Every time :()

 

The better, but slightly more complex way is to edit the sudoers file to allow your user account to execute those commands without entering your password (though you still need to use sudo).

 

You might, for example, put skynet ALL=(ALL) NOPASSWD: /usr/bin/pmset in /etc/sudoers.d/pmset to allow user skynet to run pmset without entering their password (you still have to use sudo; it just won’t ask for a password).

 

(Don’t edit any sudoers files by hand! Always use visudo, which guarantees the syntax is correct. Otherwise, if you screw it up, you might no longer be able to get the administrator privileges you need to fix it.)

Link to comment

Thanks for the heads up @deanishe I didnt think about the sudo part in the workflow, hope there is still a way to build it. I assumed because Alfred has scripting permissions it would also apply to this workflow. What about having Alfred run the above shortcuts? 

 

btw I added pmset file with 

skynet ALL=(ALL) NOPASSWD: /usr/bin/pmset

(skynet is my actual username :)

 into /etc/sudoers.d/ using visudo like you suggested, but I still get "'pmset' must be run as root..." when I try to run pmset, do I need to do something else? 

 

 

 

Edited by skynet01
Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...