Skip to content

Commit

Permalink
macOS 10.15: Request screen reader permission for AutoType
Browse files Browse the repository at this point in the history
* Fix #3609 - Request screen reader permission by faking a 1px screenshot. Thanks to MacPass for this idea.
* Fix #3578 - Remove duplicate sandbox entitlement
* Fix #3270 - Use executable path reference for libquazip
  • Loading branch information
droidmonkey committed Oct 16, 2019
1 parent dbe15d3 commit e50261a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions share/macosx/keepassxc.entitlements
Expand Up @@ -8,8 +8,6 @@
<string>production</string>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.print</key>
<true/>
<key>com.apple.security.app-sandbox</key>
Expand Down
2 changes: 2 additions & 0 deletions src/cli/CMakeLists.txt
Expand Up @@ -105,6 +105,8 @@ if(APPLE AND WITH_APP_BUNDLE)
"@executable_path/../Frameworks/libyubikey.0.dylib"
-change /usr/local/opt/ykpers/lib/libykpers-1.1.dylib
"@executable_path/../Frameworks/libykpers-1.1.dylib"
-change /usr/local/opt/quazip/lib/libquazip.1.dylib
"@executable_path/../Frameworks/libquazip.1.dylib"
keepassxc-cli
COMMENT "Changing linking of keepassxc-cli")

Expand Down
11 changes: 11 additions & 0 deletions src/gui/macutils/AppKitImpl.mm
Expand Up @@ -144,6 +144,17 @@ - (void) removeGlobalMonitor:(id) monitor
//
- (bool) enableAccessibility
{
// Request a 1 pixel screenshot to trigger the permissions
// required for screen reader access. These are necessary
// for Auto-Type to find the window titles in macOS 10.15+
CGImageRef screenshot = CGWindowListCreateImage(
CGRectMake(0, 0, 1, 1),
kCGWindowListOptionOnScreenOnly,
kCGNullWindowID,
kCGWindowImageDefault);
CFRelease(screenshot);

// Request accessibility permissions for Auto-Type type on behalf of the user
NSDictionary* opts = @{static_cast<id>(kAXTrustedCheckOptionPrompt): @YES};
return AXIsProcessTrustedWithOptions(static_cast<CFDictionaryRef>(opts));
}
Expand Down

0 comments on commit e50261a

Please sign in to comment.