Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to detect/react to system sleep events? #282

Closed
d1rewolf opened this issue Aug 23, 2021 · 4 comments
Closed

Is there a way to detect/react to system sleep events? #282

d1rewolf opened this issue Aug 23, 2021 · 4 comments
Assignees
Labels
Milestone

Comments

@d1rewolf
Copy link

  • Version: head
  • macOS: Big Sur

I'd like to be able to do certain actions when my system goes to sleep. In Hammerspoon, they have https://www.hammerspoon.org/docs/hs.caffeinate.watcher.html which works very well. I'm trying to find the equivalent in Phoenix. The closest I've found screensDidChange, but this doesn't seem to fire on system sleep.

Is there a way to do this currently?

Thanks!

@kasper
Copy link
Owner

kasper commented Oct 24, 2021

Hey @d1rewolf! No way currently, these are the supported events https://github.com/kasper/phoenix/blob/2.6.7/docs/API.md#2-events. I haven’t tested, but I wonder if the app activation events could work as a stopgap?

@d1rewolf
Copy link
Author

Thanks for the response. For the time, I've switched back to Hammerspoon, but still hope to revisit Phoenix in the future. I'll research that approach and post back here if I reach a conclusion.

@kasper
Copy link
Owner

kasper commented Nov 20, 2021

Sure! I’ll reopen this one still, so I can keep it as an improvement idea.

@kasper kasper reopened this Nov 20, 2021
@kasper kasper self-assigned this Feb 5, 2022
@kasper kasper added the feature label Feb 5, 2022
@kasper kasper added this to the 2.7 milestone Feb 5, 2022
@kasper
Copy link
Owner

kasper commented Feb 5, 2022

Added support for deviceWillSleep and deviceDidWake. Read more at https://kasper.github.io/phoenix/api/events/#device.

@kasper kasper closed this as completed Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants