Open drewbarontini opened 8 years ago
You are right, I should probably integrate some scripting definitions to be a good Cocoa and AppleScript citizen.
I'll do some research if it is easily possible to ship basic AppleScript support in the next release. I'll report any findings here.
Thanks for reminding me :grinning:
Awesome! Thank you, sir :+1:
I'm sorry for the delay, but I became absolutely discouraged from developing this feature when I saw how these AppleScript APIs and scripting definitions should be implemented 😭.
I'll have a look at this year's AppleScript-related WWDC sessions to see if there is anything new in there to make my life easier implementing scripting support.
I'll update this issue when I've gathered new insights into AppleScript. Thanks for your patience!
Just to add - I would very much like this too if it's something that's still on the cards.
Or is there a way to do it in bash
(some command line tool)? Having an API-like service can open up possibilities such as user-defined scripts (therefore a lot of custom features can be offload to user scripts), control from the touch bar, etc.
AppleScript can then call the bash script (or some command line tool) to achieve the same thing.
My use case was I wanted to reset the countdown to 5 hours via a bash script, which is how I got here.
To workaround not being able to AppleScript it, I just set the default activation period to 5 hours, then close and reopen the app from Bash. Easy peasy!
Is there still not a simple way to toggle KeepingYouAwake from the command line?
I've been using Lungo only because it has a CLI for this.
@AlecRust Since version 1.3.0 you can use URL schemes to control KYA from the command line, e.g.
open "keepingyouawake:///activate"
open "keepingyouawake:///deactivate"
open "keepingyouawake:///activate?minutes=5"
(please note the quotes when using zsh)
Is that insufficient for your use case? If that is the case I would even recommend using Apple's caffeinate
command line tool directly.
Oh that's great, thanks!
it wasn't entirely obvious to me but looking thru the source code, i found out that there is also
open "keepingyouawake:///toggle"
to, you guessed it, toggle activation state.
FYI on 1.6.5 at least to make this work consistently I had to do
open “keepingyouawake:///deactivate” && open “keepingyouawake:///activate”
Hello!
Previously, with Caffeine, I was able to use the following AppleScript to toggle it on and off via the keyboard:
When trying that with this application (subbing
"Caffeine"
with"KeepingYouAwake"
), it doesn't work. Using the Script Editor application, it seems that theactive
variable is not present. As far as I can tell, there aren't any available actions when using the Script Editor Dictionary, but I thought I'd confirm here.