{"record":{"id":"fb512d049e41a8e4","repo":"tonhowtf/omniget","slug":"teclado-macos-permissao-de-acessibilidade","errorCode":null,"errorMessage":"teclado: {} (macOS: permissao de Acessibilidade)","messagePattern":"teclado: (.+?) \\(macOS: permissao de Acessibilidade\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/dictation.rs","lineNumber":364,"sourceCode":"                \"error\",\n                0,\n                None,\n                Some(e.to_string()),\n            );\n            Err(e)\n        }\n    }\n}\n\npub fn is_recording() -> bool {\n    REC.lock().unwrap_or_else(|e| e.into_inner()).is_some()\n}\n\n/// Digita o texto onde o cursor estiver.\npub fn type_text(text: &str) -> anyhow::Result<()> {\n    use enigo::{Enigo, Keyboard, Settings};\n    let mut enigo = Enigo::new(&Settings::default())\n        .map_err(|e| anyhow!(\"teclado: {} (macOS: permissao de Acessibilidade)\", e))?;\n    // Um instante para o usuário soltar o atalho antes de digitar.\n    std::thread::sleep(std::time::Duration::from_millis(150));\n    enigo.text(text).map_err(|e| anyhow!(\"digitar: {}\", e))?;\n    Ok(())\n}\n\n/// Cmd+V / Ctrl+V (o app coloca o texto na área de transferência antes).\npub fn press_paste() -> anyhow::Result<()> {\n    use enigo::{Direction, Enigo, Key, Keyboard, Settings};\n    let mut enigo = Enigo::new(&Settings::default()).map_err(|e| anyhow!(\"teclado: {}\", e))?;\n    std::thread::sleep(std::time::Duration::from_millis(150));\n    let modifier = if cfg!(target_os = \"macos\") {\n        Key::Meta\n    } else {\n        Key::Control\n    };\n    enigo\n        .key(modifier, Direction::Press)","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/dictation.rs#L346-L382","documentation":"type_text() wraps Enigo::new(&Settings::default()) failure with 'teclado: {} (macOS: permissao de Acessibilidade)'. Enigo cannot initialize its keyboard backend — most often the process lacks Accessibility permission on macOS.","triggerScenarios":"Enigo::new() returns Err during type_text(), i.e. the synthetic keyboard backend fails to construct.","commonSituations":"macOS: app not granted Accessibility (System Settings > Privacy & Security > Accessibility); Linux: missing X11/Wayland/uinput access (no XDG_SESSION or not in input group); running in a sandboxed/bare environment with no display server.","solutions":["macOS: add the app (or terminal) to System Settings > Privacy & Security > Accessibility and restart it.","Linux: ensure a display session exists and the user has permission for the input backend (add to 'input' group for uinput, or run under X11).","Use press_paste() + clipboard as an alternative typing path if keyboard synthesis remains unavailable.","Update the enigo dependency if the backend constructor fails on a supported platform (library bug)."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// macOS (Tauri/objc): check accessibility permission before typing\n// AXIsProcessTrusted() == true means Accessibility granted","typeGuard":null,"tryCatchPattern":"match dictation::type_text(text) {\n    Err(e) if e.to_string().contains(\"teclado:\") => prompt_accessibility_permission(),\n    other => other?,\n}","preventionTips":["On macOS, request Accessibility permission during onboarding with a deep link to the settings pane.","Probe Enigo availability at startup and warn early, not on first dictation.","On Linux, prefer X11 sessions or preconfigure uinput permissions in install docs."],"tags":["keyboard","enigo","accessibility","permission-denied","macos"],"backgroundTag":"permission-denied","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}