Created
August 9, 2023 22:22
-
-
Save phillco/4c810ee6c08a817d4cdc0814db34c1d0 to your computer and use it in GitHub Desktop.
Enable accessibility on electron apps in macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from talon import ui | |
from talon.mac.ui import App | |
from talon.ui import UIErr | |
APPS = [ | |
"Slack", | |
"Google Chrome", | |
] | |
def app_activate(app: App): | |
if app.name not in APPS: | |
return | |
print(f"Setting accessibility on {app.name}...") | |
try: | |
app.element.AXManualAccessibility = True | |
except UIErr as e: | |
# This will raise "Error setting element attribute" even on success, so we print nothing. | |
# print(e) | |
pass | |
ui.register("app_activate", app_activate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment