tonhowtf/omniget · error
teclado
Error message
teclado: {} What it means
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).
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.
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
// macOS: AXIsProcessTrusted() before invoking paste // Linux: check DISPLAY/WAYLAND_DISPLAY env is set
Try / catch
match dictation::press_paste() {
Err(e) if e.to_string() == "teclado:" || e.to_string().starts_with("teclado:") => prompt_accessibility_permission(),
other => other?,
} Prevention
- 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.
When it happens
Trigger: Enigo::new() returns Err inside press_paste() before attempting the Cmd/Ctrl+V key sequence.
Common situations: macOS Accessibility permission not granted; Linux session without a usable input backend (Wayland restrictions, missing uinput rights); headless/CI environment with no display.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/9b31de44f2a521e9.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/dictation.rs:374
pub fn is_recording() -> bool {
REC.lock().unwrap_or_else(|e| e.into_inner()).is_some()
}
/// Digita o texto onde o cursor estiver.
pub fn type_text(text: &str) -> anyhow::Result<()> {
use enigo::{Enigo, Keyboard, Settings};
let mut enigo = Enigo::new(&Settings::default())
.map_err(|e| anyhow!("teclado: {} (macOS: permissao de Acessibilidade)", e))?;
// Um instante para o usuário soltar o atalho antes de digitar.
std::thread::sleep(std::time::Duration::from_millis(150));
enigo.text(text).map_err(|e| anyhow!("digitar: {}", e))?;
Ok(())
}
/// Cmd+V / Ctrl+V (o app coloca o texto na área de transferência antes).
pub fn press_paste() -> anyhow::Result<()> {
use enigo::{Direction, Enigo, Key, Keyboard, Settings};
let mut enigo = Enigo::new(&Settings::default()).map_err(|e| anyhow!("teclado: {}", e))?;
std::thread::sleep(std::time::Duration::from_millis(150));
let modifier = if cfg!(target_os = "macos") {
Key::Meta
} else {
Key::Control
};
enigo
.key(modifier, Direction::Press)
.map_err(|e| anyhow!("{}", e))?;
enigo
.key(Key::Unicode('v'), Direction::Click)
.map_err(|e| anyhow!("{}", e))?;
enigo
.key(modifier, Direction::Release)
.map_err(|e| anyhow!("{}", e))?;
Ok(())
}
View on GitHub (pinned to 8600b91f42)