Comments (8)
Hi,
The only way to test for accessibility is to register the native hook and
see if it throws an exception. If you get an exception, you should be able
to check the error code for accessibility. The error codes are defined in
the NativeHookException, See
https://github.com/kwhat/jnativehook/blob/master/src/java/org/jnativehook/NativeHookException.java#L98
If you need better control of the accessibility API, you will need to
create an OSX only JNI or JNA library to handle that functionality. Its
out of scope for this library because it only pertains to OSX.
Best Regards,
Alex
On Mon, May 18, 2015 at 10:01 AM, kaseriya [email protected] wrote:
Thank you very much for this awesome library.
Is there any way to check whether user has allowed the accessibility for
the app?When i run my app on the OS X, it asks for accessibility permission
(Accessibility API is disabled!) and dialog box opens. If user does not
allow accessibility, so i can display the message to allow the
accessibility.Thanks!!
—
Reply to this email directly or view it on GitHub
#51.
from jnativehook.
Hi,
Thanks for your quick reply,
In this case, no exception is being thrown. I see following logs
May 19, 2015 1:43:14 AM org.jnativehook.GlobalScreen$NativeHookThread enable
SEVERE: hook_run [1122]: Accessibility API is disabled!
from jnativehook.
That is definitely a bug, an exception should be raised. What version are you using?
from jnativehook.
i am using 2.0.1
from jnativehook.
This should fix it.
JNativeHook-2.0.20150523.zip | uploaded via ZenHub
from jnativehook.
It works fine now. Thanks!!
If possible then please throw some specific exception (AccessibilityException) instead of generic exception "NativeHookException" for this case.
from jnativehook.
Its possible, but all of the specific exceptions would be platform dependent. NativeHookException would still need to exist, there would just be several exception wrappers for the platform dependent items. I was originally going to implement it that way, but I don't really see a clear benefit of having the platform dependent exceptions at the library level. I came to that conclusion because all but two of the exception types, DARWIN_AXAPI_DISABLED and X11_RECORD_NOT_FOUND are unrecoverable. Furthermore, the AXAPI exception is the only one that can realistically recover at run-time, but the library does not provide a facility for doing so, again because it would be highly platform specific. I always imagined that if someone wanted to recover on OS X, the implementing application could catch the NativeHookException, check the code for DARWIN_AXAPI_DISABLED and then throw an AccessibilityException and/or ask the OS for accessibility access via JNI/JNA. If you have a different program flow in mind, please let me know. Many excellent suggestions have come from user feedback.
from jnativehook.
ohh my bad! I dint notice that NativeHookException has native error codes as well.
thanks!
from jnativehook.
Related Issues (20)
- Minecraft Sensitivity bug. HOT 5
- Explain keypad number conversions in jni_ConvertToJavaLocation(...)
- GetKeyCode() Always Returns 0 HOT 5
- GlobalKeyListener not working in windows executable file
- URI is not hierarchical
- Could you please build a new release?
- ConsoleOutput.md error?
- When packaging modular projects with jpackage, module names can't start with "app."
- Why is the NativeHookThread deliberately NOT a daemon thread? HOT 1
- Unable to extract the native library /com/github/kwhat/jnativehook/lib/windows/x86_64/JNativeHook.dll! HOT 2
- A fatal error has been detected by the Java Runtime Environment: HOT 1
- Keyboard hook notwork HOT 2
- GlobalScreen class does not implement AutoCloseable, preventing usage in try-with-resources
- GlobalScreen.postNativeEvent Not Working When Windows Screensaver Is Active
- typo in doc/Keyboard.md
- java.lang.UnsatisfiedLinkError: Unable to extract the native library
- Distinguish between virtual input and human input HOT 1
- The key combination cannot be monitored HOT 1
- How to Pause and resume keystroke events
- Keyboard event loss
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jnativehook.