How ijazsadiqbasha/whispr-electron works
Main Components
• Electron Main Process:
• Entry point: src/main.ts.
• Responsible for bootstrapping the application, handling global events (like global shortcuts), and managing inter-process communications.
• Renderer Process:
• Entry point: src/renderer.ts with supporting UI components in src/components and pages in src/pages.
• Uses React/TypeScript (components such as ThemeProvider.tsx, ui inputs, etc.) to create an interactive user interface including the overlay and settings pages.
• Native/Platform-Specific Components:
• Provided binaries (bin/MacKeyServer, bin/WinKeyServer.exe, bin/X11KeyServer) for handling system-level key capture or audio operations across platforms.
• Transcription Engine:
• Whisper model-related files (bin/whisper_base containing model.bin, config.json, tokenizer.json, etc.) that power the core speech-to-text processing.
• Supporting Libraries:
• Audio conversion and utility functions found in src/lib (e.g., audioConvert.ts, utils.ts) that handle audio processing and other helper operations.
Relationships and Interactions
• Flow from user interaction (triggering recording via UI) in the Renderer to the transcription engine, either by direct calls or through backend orchestration.
• Integration of the Whisper transcription engine: the Main or a dedicated service might pass audio data from the Recorder (within the Renderer/Post-capture in Main) to the Whisper binaries/model for transcription.
• Connections to external services (if any) such as clipboard integration, although this is primarily a local, packaged application.
Architectural Patterns and Design Principles
• Separation of Concerns: Differentiate clearly between UI components (src/components, src/pages) and backend processing (Electron Main Process and native binaries).
• Cross-Platform Support: Emphasize the usage of platform-specific binaries in the bin folder for handling system-level operations.
• Modularization: Note that the project is partitioned into logical modules (e.g., UI, libraries, audio conversion, transcription models) that ensure code reusability and easier testing.
Relevant Technologies and Frameworks
• Electron – for building cross-platform desktop applications.
• TypeScript/React – for the renderer’s UI development (evidenced by .tsx files and component structure).
• Tailwind CSS – suggested by tailwind.config.cjs and globals.css in the renderer folder.
• Whisper Model – as the transcription engine with model files located under bin/whisper_base.
• Vite – used for bundling/building the project (vite.config.ts and tsconfig.json are present).