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

Provide source for macOS lock-binary or implement different method #4

Closed
ameesme opened this issue Aug 25, 2017 · 2 comments
Closed

Comments

@ameesme
Copy link

ameesme commented Aug 25, 2017

The macOS lock-executable's source is currently not provided in the repository. Perhaps this could be added.

An alternative solution that doesn't require a binary would be to use child-process to execute the pmset displaysleepnow command. This will put the screen to sleep, which results in a lock if the user has set a log-in password and turned on "Require password after sleep or screen saver begins" in System Preferences, which should be the case anyway.

Example code

const { exec } = require('child_process');
exec('pmset displaysleepnow');
@ameesme ameesme changed the title Provide source for lock-binary Provide source for macOS lock-binary or implement different method Aug 25, 2017
@sindresorhus
Copy link
Owner

The macOS lock-executable's source is currently not provided in the repository

The source is linked to in the code:

// Binary: https://github.com/sindresorhus/macos-lock

An alternative solution that doesn't require a binary would be to use child-process to execute the pmset displaysleepnow command.

https://twitter.com/sindresorhus/status/897103870429716481

@ameesme
Copy link
Author

ameesme commented Aug 25, 2017

Ah, missed that line. Thanks for the heads up!

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

2 participants