{"record":{"id":"9b31de44f2a521e9","repo":"tonhowtf/omniget","slug":"teclado","errorCode":null,"errorMessage":"teclado: {}","messagePattern":"teclado: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/dictation.rs","lineNumber":374,"sourceCode":"pub 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)\n        .map_err(|e| anyhow!(\"{}\", e))?;\n    enigo\n        .key(Key::Unicode('v'), Direction::Click)\n        .map_err(|e| anyhow!(\"{}\", e))?;\n    enigo\n        .key(modifier, Direction::Release)\n        .map_err(|e| anyhow!(\"{}\", e))?;\n    Ok(())\n}\n","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/dictation.rs#L356-L392","documentation":"press_paste() wraps Enigo::new(&Settings::default()) failure with 'teclado: {}'. Like type_text's constructor error, Enigo cannot build its keyboard backend (typically missing Accessibility permission on macOS).","triggerScenarios":"Enigo::new() returns Err inside press_paste() before attempting the Cmd/Ctrl+V key sequence.","commonSituations":"macOS Accessibility permission not granted; Linux session without a usable input backend (Wayland restrictions, missing uinput rights); headless/CI environment with no display.","solutions":["macOS: grant the app Accessibility permission (System Settings > Privacy & Security > Accessibility).","Linux: run under X11 or grant uinput access (add user to 'input' group).","Confirm the app is running in a graphical session, not headless.","Retry after fixing permissions; Enigo must be re-constructed after the permission change."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// macOS: AXIsProcessTrusted() before invoking paste\n// Linux: check DISPLAY/WAYLAND_DISPLAY env is set","typeGuard":null,"tryCatchPattern":"match dictation::press_paste() {\n    Err(e) if e.to_string() == \"teclado:\" || e.to_string().starts_with(\"teclado:\") => prompt_accessibility_permission(),\n    other => other?,\n}","preventionTips":["Grant Accessibility permission before first use of paste features.","Run within an active graphical session; never call from services/daemons.","Re-check permissions after app updates, as TCC grants can reset."],"tags":["keyboard","enigo","paste","accessibility","permission-denied"],"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"}