Add support on MacOS to detect when the accessibility permission is removed #1636
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On macOS if you are running the barrier server and you remove the accessibility permission in System Preferences, your computer becomes unusable. You are able to move the mouse pointer around, but no clicks go through and none of the keyboard input either. I had to manually restart my computer using the power button. I guess what happens is that barrier continues to capture the input, but can't forward it on as the accessibility permission has been removed.
My fix is to periodically check if the accessibility permission is enabled and if not, terminate the application. MacOS provides no API to be notified when this permission changes, so we have to basically poll it. The fix currently checks every second, but only when barrier is started.
Contributor Checklist:
doc/newsfragments
directory IF it is auser-visible change (and make sure to read the
README.md
in that directory)