Threshold is a minimalist alarm clock application for Android and Desktop. Core Feature: It offers a "Random Window" mode where the user selects a time range (e.g., 7:00 AM - 7:30 AM), and the alarm rings once at a randomly selected time within that window.
The project is a Tauri v2 Monorepo managed with pnpm.
- Frontend: React + TypeScript + MUI (Material-UI v7).
- Backend (Host): Rust (Tauri).
- Mobile Native: Kotlin (via Custom Tauri Plugin).
- Persistence: SQLite (Rust-managed via sqlx).
apps/threshold: The main Tauri application.packages/core: Shared TypeScript types and scheduler logic (calculateNextTrigger).plugins/alarm-manager: Custom Tauri plugin wrapping Android'sAlarmManager.plugins/time-prefs: Custom Tauri plugin for 12/24h time format preference.plugins/theme-utils: Custom Tauri plugin for Material You dynamic colour extraction.
- Fixed Alarm: Standard alarm functionality (specific time).
- Random Window Alarm:
- User picks Start Time and End Time.
- App calculates a random trigger time for the next occurrence.
- Alarm rings exactly once at that random time.
- Reschedules automatically for the next active day after ringing.
- Reliability (Android):
- Must use
AlarmManager.setAlarmClockto wake from Doze mode. - Must survive device reboots (
BOOT_COMPLETEDreceiver).
- Must use
- UI/UX:
- Home: List of alarms, toggle on/off, show next trigger time.
- Edit: Mode switcher (Fixed/Window), Time inputs, Day repeat selection.
- Ringing: Full-screen activity with Dismiss/Snooze.
- Spelling: All strings must use Canadian English (e.g., "Colour", "Centre").
- Privacy: Local data only. No analytics.
- No Barrel Files: Import directly from files (e.g.,
import { Foo } from './foo';notfrom './index'). - UI Structure:
src/components/: Reusable dumb components.src/screens/: Page-level components.src/services/: Business logic singletons.
id(PK)label(Text)mode('FIXED' | 'WINDOW')fixed_time(String HH:mm)window_start(String HH:mm)window_end(String HH:mm)active_days(JSON Array of ints 0-6)next_trigger(Epoch Millis, Nullable)
- Core Logic: Rust core (
src-tauri/src/alarm/) calculates thenext_triggertimestamp and manages SQLite. - Frontend: React UI captures user input, invokes Rust commands, and listens to events for state updates.
- Plugins: React to
alarms:changedevents — alarm-manager schedules native alarms, wear-sync publishes to Wear Data Layer.