Skip to content

Architecture

ThinkUtils is a Tauri v2 app with a Rust backend and vanilla JavaScript frontend (no framework).

Overview

Backend (Rust)

All Tauri commands return ApiResponse<T> { success, data, error } for consistent error handling. System operations requiring root use pkexec (PolicyKit) — the app itself runs unprivileged.

Modules

ModulePurpose
fan_control.rsManual fan speed via /proc/acpi/ibm/fan
fan_curve.rsTemperature-based auto fan control (background task, runs every 2s)
battery.rsReads /sys/class/power_supply/BAT0|BAT1/
performance.rsCPU governor, turbo boost, power profiles via sysfs
monitor.rsSystem stats (CPU, memory, disk, network, processes)
permissions.rsOne-time permission setup via pkexec
security.rsClamAV integration
sync.rsGoogle OAuth2 + Drive-based settings backup/restore
settings.rsPersistent storage via tauri-plugin-store
system_info.rsHardware information
auth.rsOAuth helpers
mcp.rsMCP server for AI integration

Communication Pattern

Frontend (JavaScript)

Core Modules

ModulePurpose
app.jsInitialization entry point
state.jsCentralized state object (current mode, intervals, locks)
dom.jsCached DOM element references
navigation.jsView routing via sidebar data-feature attributes
settingsManager.jsLoad/save/apply settings coordination
fanCurve.jsCanvas-based interactive curve editor with draggable points
templateLoader.jsHTML template loading
titlebar.jsCustom window titlebar

View Modules (views/)

One JS file per feature: home.js, fan.js, battery.js, performance.js, monitor.js, system.js, security.js, sync.js, mcp.js.

Permission Model

See Permissions for user-facing details.

Development

bash
npm run tauri dev       # Dev mode with hot reload
npm run tauri build     # Production build
npm run validate        # Lint + format check
cargo test              # Rust tests (from src-tauri/)

Version Bumping

Version must be updated in 4 files before release:

  • package.json
  • package-lock.json (2 occurrences at top)
  • src-tauri/Cargo.toml
  • src-tauri/tauri.conf.json

After committing, tag with git tag vX.Y.Z and push — GitHub Actions builds and publishes release artifacts.

Released under the LGPL v3 License.