Rohit Posted October 27, 2021 Share Posted October 27, 2021 macOS Monterey is here and under battery there is a new feature known as low power mode. does anyone have a workflow to turn on and off via alfred?? i use this feature a lot and it would be really helpful for me to use this via alfred quickly. please🙏 JamesHalliday 1 Link to comment
skynet01 Posted October 28, 2021 Share Posted October 28, 2021 One more vote for this There is probably a way to do this using the new Shortcuts feature Link to comment
Rohit Posted October 29, 2021 Author Share Posted October 29, 2021 @skynet01 Please let me know if you are able to do this 🙏. Link to comment
skynet01 Posted November 4, 2021 Share Posted November 4, 2021 (edited) There is a shortcut for this On Reddit : Looks like it just uses simple terminal commands: Get current state: sudo pmset -g | grep lowpowermode to turn it on sudo pmset -a lowpowermode 1 and off sudo pmset -a lowpowermode 0 so implementation into workflow should be easy I just never made one. Edited November 4, 2021 by skynet01 Rohit and deanishe 2 Link to comment
Rohit Posted November 5, 2021 Author Share Posted November 5, 2021 @skynet01Thank you ...it is working...however how do i implement this with alfred??...i'm sorry i new to this workflows....could you please share if you have made this workflow?? 🙏 Link to comment
deanishe Posted November 5, 2021 Share Posted November 5, 2021 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
skynet01 Posted November 7, 2021 Share Posted November 7, 2021 (edited) 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 November 7, 2021 by skynet01 Link to comment
deanishe Posted November 8, 2021 Share Posted November 8, 2021 7 hours ago, skynet01 said: when I try to run pmset, do I need to do something else? You still have to use sudo, i.e. run sudo pmset, not just pmset. Link to comment
skynet01 Posted November 11, 2021 Share Posted November 11, 2021 Ah yes, its working now @deanishe . Btw @Rohit I was able to get this all to work with Shortcuts workflow that I found here: https://github.com/lukdiekm/alfred-shortcuts/releases/tag/v0.3.1 Then you can just run the low power mode shortcuts using Alfred Rohit 1 Link to comment
Rohit Posted November 11, 2021 Author Share Posted November 11, 2021 @skynet01 Thank You:🙏 Link to comment
vitor Posted December 18, 2021 Share Posted December 18, 2021 Heads-up, made a Workflow which doesn’t require authentication to change Low Power Mode settings. It does it by automating the Systems Preferences pane. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now