File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed
Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 88
99extern " C" AXError _AXUIElementGetWindow (AXUIElementRef, CGWindowID* out);
1010
11- NSDictionary * opts = @{static_cast <id > (kAXTrustedCheckOptionPrompt ): @YES };
12- BOOL a = AXIsProcessTrustedWithOptions(static_cast <CFDictionaryRef> (opts));
11+ Napi::Boolean requestAccessibility (const Napi::CallbackInfo &info) {
12+ Napi::Env env{info.Env ()};
13+
14+ NSDictionary * opts = @{static_cast <id > (kAXTrustedCheckOptionPrompt ): @YES };
15+ BOOL a = AXIsProcessTrustedWithOptions (static_cast <CFDictionaryRef> (opts));
16+
17+ return Napi::Boolean::New (env, a);
18+ }
1319
1420std::map<int , AXUIElementRef> m;
1521
@@ -223,6 +229,8 @@ AXUIElementRef getAXWindow(int pid, int handle) {
223229 Napi::Function::New (env, setWindowMinimized));
224230 exports.Set (Napi::String::New (env, " setWindowMaximized" ),
225231 Napi::Function::New (env, setWindowMaximized));
232+ exports.Set (Napi::String::New (env, " requestAccessibility" ),
233+ Napi::Function::New (env, requestAccessibility));
226234 return exports;
227235}
228236
Original file line number Diff line number Diff line change 3030 },
3131 "homepage" : " https://github.com/sentialx/node-window-manager#readme" ,
3232 "devDependencies" : {
33- "@types/node" : " 12.0.8 " ,
34- "tslint" : " 5.17.0 " ,
35- "typescript" : " 3.5.1 "
33+ "@types/node" : " 12.12.7 " ,
34+ "tslint" : " 5.20.1 " ,
35+ "typescript" : " 3.7.2 "
3636 },
3737 "dependencies" : {
38- "node-addon-api" : " 1.6.3 " ,
39- "node-gyp" : " 5 .0.0 "
38+ "node-addon-api" : " 1.7.1 " ,
39+ "node-gyp" : " 6 .0.1 "
4040 }
4141}
Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ class WindowManager extends EventEmitter {
5151 } ) ;
5252 }
5353
54+ requestAccessibility = ( ) => {
55+ if ( platform ( ) !== 'darwin' ) return false ;
56+ return addon . requestAccessibility ( ) ;
57+ }
58+
5459 getActiveWindow = ( ) => {
5560 if ( ! addon ) return ;
5661 return new Window ( addon . getActiveWindow ( ) ) ;
You can’t perform that action at this time.
0 commit comments