Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/devv-shayan/Trueears/llms.txt

Use this file to discover all available pages before exploring further.

The Trueears backend exposes functionality to the frontend through Tauri commands. All commands are called via invoke from @tauri-apps/api/core.

Importing invoke

import { invoke } from '@tauri-apps/api/core';

Basic invocation

import { invoke } from '@tauri-apps/api/core';

try {
  const windowInfo = await invoke<ActiveWindowInfo | null>('get_active_window_info');
  console.log('Active window:', windowInfo?.window_title);
} catch (error) {
  // error is always a string — the Rust error message
  console.error('Command failed:', error);
}

Error handling

All commands return Result<T, String> in Rust. The Tauri bridge translates this to a JavaScript Promise:
  • Success — the promise resolves with the return value.
  • Failure — the promise rejects with a string containing the Rust error message.
try {
  await invoke('set_store_value', { key: 'theme', value: 'dark' });
} catch (error) {
  // `error` is a string, not an Error object
  console.error('Command failed:', error);
}

TypeScript types

The following interfaces are used throughout the API. They match the Rust structs defined in the backend source.
// From backend/src/window.rs
interface ActiveWindowInfo {
  app_name: string;        // Executable filename, e.g. "Code.exe"
  window_title: string;    // Window title bar text
  executable_path: string; // Full path to the executable
  url: string | null;      // Active browser URL (browser windows only)
}

// From backend/src/lib.rs
interface CursorPosition {
  x: number;  // Horizontal screen coordinate
  y: number;  // Vertical screen coordinate
}

// From backend/src/installed_apps/windows_impl.rs
interface InstalledApp {
  name: string;      // Display name
  exe_name: string;  // Executable filename
  exe_path: string;  // Full path to the executable
}

// From backend/src/auth.rs
interface AuthState {
  is_authenticated: boolean;
  user: UserInfo | null;
}

interface UserInfo {
  id: string;             // Google account user ID
  email: string;          // Google account email address
  name: string | null;    // Display name (may be null)
  picture: string | null; // Profile photo URL (may be null)
}

// From backend/src/log_mode.rs
interface PathValidation {
  valid: boolean;               // Whether path can be used as a log destination
  exists: boolean;              // Whether file already exists
  parent_exists: boolean;       // Whether parent directory exists
  writable: boolean;            // Whether file/directory is writable
  error_message: string | null; // Reason if not writable
}

// From backend/src/shortcuts.rs
interface ShortcutPressedPayload {
  window_info: ActiveWindowInfo | null;
  selected_text: string | null;
}

Command categories

Settings

Read and write persistent application settings via the Tauri store plugin.

Window Management

Detect the active window, get cursor position, and control overlay behavior.

Dictation & Automation

Paste transcribed text and copy selected text using OS-level automation.

Hotkey Management

Dynamically register and unregister the Escape key shortcut during recording.

App Discovery

Search installed applications for use in App Profile configuration.

Authentication

Google OAuth login, session state, and logout.

Log Mode

Append timestamped voice notes to log files.

Events

Backend events the frontend can subscribe to via Tauri’s event system.

Build docs developers (and LLMs) love