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

[macOS] Set state to AFK when screen is locked or computer is asleep #66

Open
naturecodevoid opened this issue Jan 26, 2024 · 1 comment

Comments

@naturecodevoid
Copy link

I suggest that whenever loginwindow is the current window on macOS, the state be changed to AFK. loginwindow is what is shown when the computer is locked, which means the user is away from their computer. This can be observed with aw-watcher-window.

@naturecodevoid
Copy link
Author

naturecodevoid commented Jan 28, 2024

A better way to do this would be to check the CGSSessionScreenIsLocked key of the session info dictionary. See this StackOverflow answer for more info: https://stackoverflow.com/a/11511419

There is also a pure bash answer, if the Quartz library is not available (it wasn't when I tried): https://stackoverflow.com/a/66723000

This solution can also be easily packaged into a ~10 line C program, let me know if that would be useful.

@naturecodevoid naturecodevoid changed the title [macOS] The state should be changed to AFK when loginwindow is the current window [macOS] Set state to AFK when screen is locked or computer is asleep Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant