Skip to content

Instantly share code, notes, and snippets.

@phillco
Created August 9, 2023 22:22
Show Gist options
  • Save phillco/4c810ee6c08a817d4cdc0814db34c1d0 to your computer and use it in GitHub Desktop.
Save phillco/4c810ee6c08a817d4cdc0814db34c1d0 to your computer and use it in GitHub Desktop.
Enable accessibility on electron apps in macOS
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