Commit Graph
15 Commits
Author SHA1 Message Date
3f5a5effff feat(vad): add Silero VAD and drop silence-only buffers (#447)
* feat(vad): replace amplitude-based VAD with Silero neural network

Replace the simple amplitude threshold VAD with Silero VAD, a lightweight
neural network model that classifies audio as speech/non-speech. This
addresses the root cause of #302 (silence not stopping recording) and

- Add silero_vad.py wrapper using ONNX Runtime with bundled Silero v5 model
- Accumulate 512-sample chunks with 64-sample context window per official API
- Map existing vad_sensitivity (1-5) to Silero thresholds (0.8-0.3)
- Use max() across sub-chunks to avoid missing speech onsets
- Fall back to amplitude VAD when onnxruntime is unavailable
- Add onnxruntime as optional dependency (pip install vocalinux[vad])

Closes #344

* address review: add tests, LICENSE, logging, validation fixes

- Add unit tests for SileroVAD (process, reset, fallback, sensitivity mapping)
- Add MIT LICENSE for bundled Silero VAD model in data/
- Log which VAD backend is active on init
- Validate chunk length in SileroVAD.process()
- Skip is_speech check until a full Silero chunk is processed
- Add thread safety note to SileroVAD docstring
- Document resampling rate effect on VAD resolution
- Comment explaining why load_silero_vad() catches broad Exception

* address review: bundle license, document [vad] extra, surface backend in UI

- Pack data/LICENSE into the wheel (pyproject package-data) so attribution
  travels with the model
- README: short note on enabling neural VAD via vocalinux[vad]
- Settings: VAD Sensitivity row subtitle shows the active backend; if
  onnxruntime is missing, an info-row beneath the group spells out the
  install command and the restart requirement
- silero_vad.is_silero_available() probes onnxruntime + model presence
  w/o instantiating an InferenceSession
- CI installs .[dev,vad] so Silero paths get exercised
- Integration test for _record_audio Silero branch (mocked pyaudio +
  scripted SileroVAD), covering silence flush, speech reset, and
  sensitivity threshold mapping at sens=1 vs sens=5
- Tests no longer skip when other modules globally mock numpy: pop the
  top-level numpy ref so a fresh import gives the real package, and
  swap sys.modules["numpy"] inside the _record_audio call so the lazy
  import inside the function picks up real numpy too

* fix(vad): drop silence-only recording buffers

* test(vad): align stop buffer expectations

* test(vad): preserve real numpy module

* fix(install): install vad support opportunistically

* test(vad): cover recognition manager vad edges

---------

Co-authored-by: Sbenazar <127324689+Sbenazar@users.noreply.github.com>
2026-06-02 12:43:51 -07:00
Jatin K MalikandGitHub c44b06996e fix: add Python 3.14 support and lxml>=6.1.0 (fixes #404)
- Add Python 3.14 to classifiers
- Add lxml>=6.1.0 to dependencies to fix install on Python 3.14 (CachyOS, Arch)
- Update black target-version to include py314

Fixes #404
Closes #405
2026-05-02 17:28:17 -07:00
Jatin K MalikandGitHub 860a9f9ae6 fix: Bundle resources in package to fix missing system tray icons (fixes #349) (#354)
* fix: bundle resources in package to fix missing icons in system tray (fixes #349)

The resources directory (icons and sounds) was not included in pip-installed
packages because it lived outside the src/ package directory. This caused
the resource_manager to find an empty icon directory at runtime, resulting in
the ellipsis (three dots) icon in the GNOME system tray.

Changes:
- Copy resources into src/vocalinux/resources/ so setuptools bundles them
- Add 'vocalinux.resources/**/*' to package-data in pyproject.toml
- Add MANIFEST.in for sdist builds
- Update resource_manager to check package-bundled resources first
  (module_dir.parent / 'resources') before checking external paths
- Add install_resources_to_venv() to install.sh for curl-based installs,
  copying resources to /share/vocalinux/resources

This fixes both pip installs (resources bundled in the wheel) and curl-based
installs (resources copied to venv share directory).

* fix: ensure bundled resources are included in sdist and pip installs

- Add 'vocalinux.resources' to setuptools packages list so the
  subpackage (and its __init__.py) is recognized by setuptools
- Add __init__.py to src/vocalinux/resources/ to make it a proper
  Python subpackage for reliable discovery
- Add 'recursive-include src/vocalinux/resources *' to MANIFEST.in
  so sdist archives include the bundled icons and sounds
2026-03-27 11:07:19 -07:00
Jatin K MalikandGitHub fa17b88f74 chore: bump minimum Python from 3.8 to 3.9 (#336)
* chore: bump minimum Python from 3.8 to 3.9 and adopt PEP 585 builtins

- Update requires-python, classifiers, mypy target, and black target in pyproject.toml
- Replace Python 3.8 with 3.9 in CI matrix and nightly workflow
- Replace typing.List/Dict/Tuple/Set with builtin list/dict/tuple/set (PEP 585)
- Update all 3.8 version references in README, docs, website, and install.sh
- Fix test_wayland_no_tools to mock IBus availability
- Remove List from common_types re-exports and update test

* style: reformat test files for Black 26.x and pin version in CI

Black 26.x introduced parenthesized context manager formatting.
Reformat 7 test files and pin Black>=26,<27 in CI to prevent
future drift from unpinned version upgrades.
2026-03-21 12:15:10 -07:00
Jatin K MalikandGitHub fa4da40e7b test(coverage): improve test coverage from 57% to 80%+ (#327)
* test(coverage): improve test coverage from 57% to 80%+

Add 30 new test files with 861 additional test cases to improve
overall test coverage from 57% to 80%+ (statement coverage).

Key modules covered:
- recognition_manager.py: 43% → 69% (audio device detection, transcription,
  model download, engine initialization, buffer management)
- text_injector.py: improved coverage for X11/Wayland text injection,
  environment detection, clipboard fallback, shortcut injection
- ibus_engine.py: 22% → 73% (engine lifecycle, text injection, socket server)
- evdev_backend.py: 11% → 78% (device detection, key event handling)
- pynput_backend.py: 43% → 76% (start/stop, key handling, callbacks)
- keyboard_backends/__init__.py: 54% → improved (backend creation, env detection)
- whispercpp_model_info.py: 32% → improved (GPU detection, model recommendations)
- about_dialog.py, first_run_dialog.py, main.py, single_instance.py,
  common_types.py, config_manager.py, autostart_manager.py: various improvements

All 1433 tests pass with proper test isolation to prevent mock pollution
between test modules.

* test(quality): audit and fix test quality issues

Code review audit identified and fixed the following issues:

- Remove bare try/except blocks that swallow all errors (7 tests fixed
  in recognition_manager_deep, replaced with proper assertions or deleted)
- Delete source code inspection tests that read .py files as strings
  instead of testing behavior (deleted test_about_dialog_coverage.py and
  test_first_run_dialog_coverage.py entirely - ~35 useless tests removed)
- Add meaningful assertions replacing weak assertIsNotNone/assertIsInstance
  checks (common_types_coverage, ibus_engine_coverage, keyboard_backends_extra)
- Fix tests that mock the system under test instead of its dependencies
  (text_injector_extra now mocks subprocess.run instead of injection methods)
- Add missing assertions to tests with no verification
  (ibus_engine focus_out, log window info, copy to clipboard)
- Verify download tests check requests.get was called with correct URLs
  (coverage_boost download tests)
- Fix pytest warning by renaming test_audio_input import to avoid
  pytest collecting it as a test function

All 1356 tests pass with 0 failures and 0 warnings.
Statement coverage: 80.3% (3257/4054 lines covered).

* style(tests): fix black formatting and isort import ordering

Auto-format all new test files with black and isort to pass CI lint checks.

* fix(tests): resolve CI hangs and rename test files for clarity

- Fix CI hangs by properly mocking gi/GTK/IBus in all test files
- Fix sys.modules pollution in recognition manager tests by using tmp_path
- Add pytest-timeout to prevent future hangs
- Rename 28 test files to use descriptive, consistent names mapping to source modules

* fix(tests): resolve Python 3.13 CI failures

- Fix _load_stdlib_module() in test_recognition_manager_downloads.py to
  handle stdlib modules that are packages (directories with __init__.py)
  rather than single .py files. In Python 3.13, zipfile became a package,
  causing FileNotFoundError during test collection (exit code 2).

- Fix invalid escape sequence '$' in test_cross_distro_compatibility.py
  by using a raw string. Python 3.13 reports this as SyntaxWarning and
  Python 3.14 will make it a SyntaxError.

* fix(tests): use direct import for zipfile instead of _load_stdlib_module

The _load_stdlib_module approach fails on Python 3.13 where zipfile is a
package (zipfile/__init__.py). Loading it via spec_from_file_location with
a custom name breaks relative imports inside the package (e.g.
'from ._path import ...' resolves to '_stdlib_zipfile._path' which doesn't
exist).

Simply import zipfile at module level before any test mocks can pollute
sys.modules — this is safe because the module-level code runs during test
collection, before any test fixtures or patches are applied.

* fix(tests): mock gi/GTK in conftest to prevent CI hangs

On CI, real PyGObject is installed and module-level imports in vocalinux
source files (ibus_engine, tray_indicator, settings_dialog, etc.) trigger
GTK initialization or IBus daemon connections that hang indefinitely in
headless environments. pytest-timeout's signal-based timeout cannot
interrupt these C-level blocking calls.

Fix by mocking gi and gi.repository in conftest.py (which runs before any
test module is collected), ensuring all test files are protected regardless
of whether they remember to mock individually.

Also add timeout-minutes: 10 to the CI test job as a safety net so that
any remaining hangs fail fast instead of running indefinitely.

* fix(tests): unconditionally mock gi in conftest for CI

The previous 'if gi not in sys.modules' guard was ineffective on CI
because PyGObject is installed via pip, so the real gi module is already
loaded. This caused GTK initialization and IBus daemon connections that
hang indefinitely in headless CI environments.

Now unconditionally replace gi and gi.repository with mocks during test
collection, regardless of whether the real package is installed.

* fix(tests): reduce timeout to 10s and use thread-based timeout

Use timeout_method=thread instead of signal (default) so that
pytest-timeout can interrupt C-level blocking calls (GTK operations,
socket accepts, subprocess waits) that the signal-based method cannot
handle. Also reduce per-test timeout from 30s to 10s since no legitimate
unit test should take longer, and hanging tests were consuming the entire
CI job timeout budget.

* fix(tests): set global socket timeout to prevent blocking on CI

Tests in test_ibus_engine.py create real Unix sockets with daemon threads
that block on socket.accept(). When tests fail or timeout, these threads
remain blocked indefinitely, preventing pytest from completing. The
thread-based timeout catches the hang but cannot terminate the blocking
accept() call.

Set socket.setdefaulttimeout(5) in conftest.py so all socket operations
(accept, connect, recv) will raise socket.timeout after 5 seconds instead
of blocking forever.

* fix(tests): add cleanup fixture for IBus socket server threads

Add autouse fixture that stops any leftover VocalinuxEngine socket server
threads after each test. Tests that trigger _start_socket_server() spawn
daemon threads blocking on socket.accept() that persist after the test
completes, eventually causing pytest-timeout to kill the process.

The cleanup fixture sets _server_running=False and closes the server
socket, which unblocks the accept() call and allows the daemon thread
to terminate.

* fix(tests): reduce socket timeout to 0.1s to avoid slowing tests

The 5-second socket timeout caused socket operations in daemon threads
to block for 5 seconds per iteration before timing out, significantly
slowing the test suite on CI. Reduce to 0.1s so blocking socket calls
fail fast without noticeably impacting test execution time.

* fix(tests): use 2s socket timeout and increase CI timeout to 15min

The 0.1s socket timeout was too aggressive and caused legitimate test
socket operations to fail. Use 2s which is long enough for test sockets
to work but short enough to unblock daemon threads.

Increase CI job timeout to 15 minutes to accommodate the socket timeout
overhead from daemon threads that retry every 2 seconds.

* fix(tests): block known-blocking daemon threads to prevent CI hangs

Instead of using socket timeouts (which either break tests or are too
slow), prevent specific known-blocking daemon threads from starting:
- ibus_engine.server_thread: blocks on socket.accept()
- evdev_backend._monitor_devices: blocks on select.select()

These threads are identified by their target function name and skipped
during Thread.start(). The thread is marked as started/stopped so
join() calls in cleanup code don't raise RuntimeError.

Test-created daemon threads (e.g. mock socket servers) are unaffected
since they use different target function names.

* fix(tests): patch Thread.join for Python 3.13 compatibility

Python 3.13 changed threading internals — join() now uses _handle.join()
which raises 'thread not started' for threads that were never actually
started. Instead of trying to fake internal state, patch join() to be a
no-op for threads that were skipped by our _safe_thread_start guard.

This fixes the 2 remaining test_evdev_backend_ext failures on Python 3.13.
2026-03-17 14:05:16 -07:00
Jatin K MalikandGitHub d3e1bd7128 Fix #221: Add missing psutil dependency (#223)
pywhispercpp requires psutil internally but doesn't declare it as a dependency,
causing vocalinux to fail on fresh installs with:
  Failed to import pywhispercpp: No module named 'psutil'

Adding psutil>=5.9.0 to vocalinux's dependencies as a workaround.
2026-02-17 19:02:53 -08:00
Jatin K MalikandGitHub 57a0ddd0b8 feat(speech): add whisper.cpp with Vulkan support for GPU acceleration (#179)
* feat(speech): add whisper.cpp with Vulkan support for GPU acceleration

Add whisper.cpp as a new speech recognition engine with the following features:
- Vulkan GPU acceleration support (AMD, Intel, NVIDIA)
- Fallback to CUDA for NVIDIA GPUs
- CPU-only mode with automatic thread optimization
- Support for all model sizes: tiny, base, small, medium, large
- Hardware detection to recommend best model/backend
- Models downloaded from Hugging Face (ggml format)
- Updated UI to show compute backend info in settings
- pywhispercpp as the Python binding library
- whisper_cpp as the new default engine

Changes:
- New whispercpp_model_info.py with model metadata and hardware detection
- Updated recognition_manager.py with whisper.cpp init and transcription
- Updated settings_dialog.py with whisper.cpp UI support
- Updated config_manager.py with whisper_cpp_model_size config
- Updated main.py with whisper_cpp CLI option
- Updated pyproject.toml with pywhispercpp dependency
- Updated install.sh with vulkan-tools for GPU detection

Closes #104

* style: fix black and isort formatting issues

* test: update config manager test for whisper_cpp default engine

* feat(install): interactive mode with 3 engine choices and whisper.cpp as default

Major changes to install.sh:
- Interactive mode is now the DEFAULT (not --auto)
- Added --auto flag for non-interactive automatic installation
- New --engine flag to specify engine directly
- Interactive mode shows 3 engine options with visual boxes:
  1. whisper.cpp (recommended) - Vulkan/CUDA/CPU support
  2. whisper (OpenAI) - PyTorch-based, NVIDIA-only
  3. VOSK - lightweight option
- Hardware detection with recommendations:
  - Detects Vulkan support (AMD/Intel/NVIDIA)
  - Detects NVIDIA CUDA
  - Checks available RAM
  - Recommends best engine based on hardware
- Updated help text with new options and examples
- Removed old --with-whisper, --whisper-cpu, --no-whisper flags
- whisper.cpp is now the default engine for automatic mode

* feat(uninstall): kill running vocalinux processes before uninstall

* fix(whisper.cpp): auto-download model, use all CPU cores, hide unavailable engines

Three fixes for whisper.cpp implementation:

1. Auto-download model during install
   - Added install_whispercpp_model() function to install.sh
   - Downloads ggml-tiny.bin (~39MB) from Hugging Face
   - Runs automatically when whisper.cpp engine is selected

2. Use all CPU cores for transcription
   - Added n_threads parameter to Model initialization
   - Uses multiprocessing.cpu_count() to get all cores
   - Significantly improves transcription speed

3. Hide unavailable engines from dropdown
   - Added get_available_engines() function to detect installed engines
   - Settings dialog now only shows engines that are actually installed
   - Falls back to first available engine if current not available

Fixes user-reported issues with whisper.cpp integration.

* ui(settings): display whisper.cpp correctly and increase dialog height

- Changed engine display name from 'whisper_cpp' to 'whisper.cpp'
- Added format_engine_display_name() helper function
- Dialog now uses 75% of screen height for better visibility
- More options visible by default without scrolling

* revert(settings): remove display name change, keep dialog height increase

- Reverted engine display name change (was breaking engine selection)
- Kept dialog height at 75% of screen for better visibility

* style: fix black and isort formatting for whisper.cpp logging

* style: fix black formatting in settings_dialog.py

* ci: fix Fedora 39 container package installation

Add dnf cache update and fallback with --nogpgcheck for Fedora containers
that may have stale or missing package metadata.
2026-02-11 19:37:58 -08:00
Jatin K MalikandGitHub d004a401af chore(release): prepare v0.5.0-beta (#148)
This commit prepares the repository for the v0.5.0-beta release,
transitioning from alpha to beta status.

Changes made:
- Update version from 0.4.1-alpha to 0.5.0-beta in version.py
- Update Development Status classifier from Alpha to Beta in pyproject.toml and setup.py
- Update status badges from Alpha (orange) to Beta (blue) in README.md
- Update all installation command examples to use v0.5.0-beta tag
- Update release announcement from Alpha to Beta in README.md
- Add RELEASE_PROCESS.md documentation for future releases
- Update docs/INSTALL.md with new version references
- Add What's New section for v0.5.0-beta in docs/UPDATE.md
- Update SECURITY.md supported versions table
- Update website schema softwareVersion in layout.tsx
- Update website version badges in page.tsx
- Update website package.json version to 0.5.0

Testing:
- All 463 tests passing (100%)
- Version consistency verified across all files

Release process documentation added to docs/RELEASE_PROCESS.md
2026-02-05 19:00:17 -08:00
Jatin K MalikandGitHub e46c37d80e fix: Add missing keyboard_backends package to pyproject.toml (#126)
The vocalinux.ui.keyboard_backends module was not being installed because
it wasn't listed in the packages configuration. This caused a ModuleNotFoundError
when trying to launch Vocalinux after installation.

Fixes installation issue where the app fails to start with:
ModuleNotFoundError: No module named 'vocalinux.ui.keyboard_backends'
2026-02-04 23:39:32 -08:00
jatinkrmalik f8338929c1 Revert direct push to main - will create PR instead 2026-02-04 23:37:13 -08:00
jatinkrmalik 2bd7969143 fix: Add missing keyboard_backends package to pyproject.toml
The vocalinux.ui.keyboard_backends module was not being installed because
it wasn't listed in the packages configuration. This caused a ModuleNotFoundError
when trying to launch Vocalinux after installation.

Fixes installation issue where the app fails to start with:
ModuleNotFoundError: No module named 'vocalinux.ui.keyboard_backends'
2026-02-04 23:35:46 -08:00
6f54dd80e0 Fix Python 3.13 and Wayland compatibility (#125)
* Fix Python 3.13 and Wayland compatibility

This commit addresses installation failures on modern Linux distributions
(Ubuntu 25.10+) with Python 3.13 and Wayland-only sessions.

Changes:

1. **Add Python 3.13 support** (pyproject.toml)
   - Add Python 3.13 to classifiers
   - Update black target versions to include py312, py313
   - No code changes needed - already compatible

2. **Use system site-packages for PyGObject** (install.sh)
   - Change venv creation to use --system-site-packages flag
   - Avoids PyGObject build failures with Python 3.13
   - System PyGObject (python3-gi) is already installed as dependency
   - Building from source is unnecessary and fragile with new Python versions

3. **Improve Wayland text injection support** (install.sh)
   - Install ydotool as fallback (wtype doesn't work with GNOME Wayland)
   - Add user to 'input' group for uinput device access
   - Install udev rule for /dev/uinput permissions
   - Provide clear warning about logout requirement

Technical details:
- wtype uses Wayland virtual keyboard protocol (not supported by GNOME)
- ydotool uses Linux uinput kernel module (works with all compositors)
- System PyGObject 3.50.0+ supports Python 3.13
- Building PyGObject 3.54.5 from source fails with Python 3.13 build tools

Fixes installation on:
- Ubuntu 25.10 (Questing Quokka) - Wayland-only, Python 3.13
- Arch Linux with Python 3.13
- Fedora 41+ with Python 3.13

Tested on: Ubuntu 25.10 with Python 3.13.7, GNOME 49 Wayland

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* Prioritize ydotool over wtype for universal Wayland compatibility

wtype uses the virtual-keyboard Wayland protocol which is not supported
by GNOME/Mutter compositors. ydotool uses the Linux uinput kernel module
which works with all Wayland compositors including GNOME.

This change swaps the priority order to check ydotool first, ensuring
text injection works on GNOME Wayland (Ubuntu 25.10+) while still
falling back to wtype for compositors that support it.

Tested on Ubuntu 25.10 with GNOME 49 Wayland - text injection now works
perfectly with ydotool.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* ci: trigger workflow run

* ci: run lint/tests on python 3.13

---------

Co-authored-by: ACT900 <179795730+ACT900@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 22:31:24 -08:00
Jatin K MalikandGitHub 9e5b632710 test: Improve test coverage to 80%+ (#122)
* test: Improve test coverage to 80%

Increased test coverage from ~33% to 80.15% statement coverage.

New test files added:
- test_action_handler.py (100% coverage)
- test_version.py (100% coverage)
- test_logging_manager.py (100% coverage)
- test_common_types.py
- test_speech_recognition_init.py (100% coverage)
- test_resource_manager.py (93% coverage)

Significantly expanded existing tests:
- test_tray_indicator.py: 76% -> 98%
- test_main.py: 50% -> 92%
- test_text_injector.py: 60% -> 94%
- test_recognition_manager.py: 30% -> 48%
- test_command_processor.py: 85% -> 98%
- test_keyboard_shortcuts.py: 88% -> 95%
- test_config_manager.py: improved to 98%
- test_audio_feedback.py: improved to 92%

Configuration changes:
- Updated pyproject.toml to exclude untestable GTK dialog files
  (settings_dialog.py, logging_dialog.py) from coverage metrics

Key testing improvements:
- Added comprehensive GTK mocking for UI components
- Added edge case tests for text injection on X11/Wayland
- Added keyboard shortcut injection tests
- Added error handling and callback tests
- Added configuration management tests

* fix: Use runtime CI mode detection to fix Python 3.8/3.10 tests

Change CI_MODE from module-level constant to _is_ci_mode() function
that is evaluated at runtime. This ensures pytest detection works
correctly on all Python versions, since pytest modules may not be
loaded at import time.

* fix: Add PYTEST_RUNNING env var for reliable pytest detection in CI

The previous approach to detect pytest at runtime wasn't working
reliably on Python 3.8/3.10 in CI environments. This adds a
PYTEST_RUNNING=1 environment variable set early in conftest.py
that _is_ci_mode() can check to reliably determine if tests are
running.

* fix: Use patch.object for reliable mocking in audio_feedback tests

The previous approach using patch() with module paths didn't work
reliably because the module reimport caused the patched objects
to not be the same as the ones the functions referenced.

Using patch.object() on the imported module's attributes ensures
the patches are applied to the actual objects the functions use.

* fix: Use patch.object for reliable mocking in test_settings_callback

The test was failing on Python 3.8/3.10 because the module-level patch
for SettingsDialog wasn't being applied reliably across all Python
versions due to import timing differences.

Using patch.object() on the imported module ensures the mock is applied
to the actual reference that _on_settings_clicked() uses, regardless of
Python version or module caching behavior.
2026-02-04 21:01:34 -08:00
Jatin K MalikandGitHub 22ab96cea7 feat: add Wayland support for keyboard shortcuts using evdev backend (#81)
* feat: add Wayland support for keyboard shortcuts using evdev backend

This commit adds multi-backend support for keyboard shortcuts, enabling
them to work on Wayland sessions where pynput does not work.

**Changes:**
- New `keyboard_backends/` package with modular backend system
  - `base.py`: Abstract base class for keyboard backends
  - `pynput_backend.py`: Existing pynput implementation (X11/XWayland)
  - `evdev_backend.py`: New evdev implementation (X11 & Wayland)
  - `__init__.py`: Backend factory with auto-detection

- Updated `keyboard_shortcuts.py`:
  - Refactored to use backend system
  - Auto-detects session type (X11 vs Wayland)
  - Selects appropriate backend automatically
  - Provides helpful error messages when shortcuts unavailable

- Added `evdev>=1.6.0` to dependencies (Linux only)

- Comprehensive test updates:
  - 21 tests pass covering all backends
  - Tests for session detection
  - Tests for backend factory
  - Tests for permission hints

**User Impact:**
- Keyboard shortcuts now work on Wayland when user is in 'input' group
- Clear error messages guide users to fix permission issues
- Backward compatible with X11 (pynput backend)

**Setup for Wayland:**
```bash
sudo usermod -a -G input $USER
# Log out and log back in
```

Related to #80

* style: fix flake8 issues in evdev_backend.py

- Remove unused import 'categorize'
- Remove unused variable 'dev'

* style: fix remaining flake8 issues in tests

- Remove unused 'time' import
- Remove unused 'result' variable
- Remove unused 'backend_cls' variable
- Break long line to stay under 100 characters

* style: apply black and isort formatting to pass CI

* feat: auto-configure Wayland keyboard shortcuts during installation

Automatically detect Wayland sessions during installation and add the user
to the 'input' group required for evdev-based keyboard shortcuts.

This eliminates the need for users to manually configure permissions
after installation on Wayland systems.

* fix: escape commit message in Detect Changes step to handle special characters

The commit message was being directly inserted into the bash comparison,
which broke when the message contained special characters like parentheses.
Fix by assigning to a variable first.

* chore: drop unrelated installer/web changes

* fix: fall back to evdev backend

* style: format keyboard shortcut imports
2026-02-04 20:14:58 -08:00
Jatin K MalikandGitHub 1dc1d44665 feat: Alpha Launch v0.2.0 - Complete UX Overhaul 🚀🎤 (#39)
* feat: prepare for v0.2.0-alpha release

* feat: prepare for v0.2.0-alpha release

* chore: remove CHANGELOG.md, use GitHub Releases instead

* refactor: use existing About dialog instead of Settings section

* style: enhance About dialog UI readability

* style: fix formatting with black and isort

* feat: show VAD and silence timeout settings for Whisper engine

- Renamed 'VOSK Settings' to 'Recognition Settings'
- VAD Sensitivity and Silence Timeout now apply to both engines
- Added tooltips explaining each setting
- VOSK-specific model info only shown when VOSK selected

* fix: resolve overlapping UI elements in settings dialog

* fix: save VAD and silence timeout settings for both engines

Previously these settings were only saved when VOSK was selected.
Now they persist correctly for Whisper as well.

* fix: show download progress when selecting undownloaded model

Previously when auto-applying settings, models would download silently
in the background without showing the progress dialog. Now:
- Download progress dialog appears for undownloaded models
- Model icons update correctly after download completes

* feat: add download progress, speed, ETA and cancel button

- Show real download progress percentage for VOSK models
- Display download speed (MB/s) and estimated time remaining
- Add Cancel button to abort downloads
- Update status during extraction phase
- Whisper downloads still pulse (uses internal downloader)

* fix: defer model download until needed, don't block startup

- App now starts instantly even if models aren't downloaded
- Models are downloaded on-demand when selected in Settings
- If user tries to dictate without a model, plays error sound
- Added model_ready property to check if engine is usable

* fix: improve first-run UX without downloaded models

- Settings dialog now defaults to smallest available model, not saved config
- Only show saved model if it's actually downloaded
- Add desktop notification when trying to dictate without a model
- Prevents auto-downloading large models on first launch

* feat: add download progress tracking for Whisper models

- Implement custom Whisper model download with progress/speed/ETA
- Uses OpenAI's CDN URLs directly instead of whisper.load_model()
- Progress callback works the same as VOSK downloads
- Supports cancellation during download

* fix: enable download progress callback for Whisper models

Progress callback was only being set for VOSK downloads, not Whisper.
Now both engines show real-time progress, speed, and ETA.

* fix: update tests for defer_download and config manager mocking

- test_main: Mock ConfigManager to prevent saved config from overriding test values
- test_settings_dialog: Mock ModelDownloadDialog to prevent GTK init errors
- test_speech_recognition: Use proper MockVoskModule class instead of MagicMock, pass defer_download=False for download test
- test_whisper_support: Pass defer_download=False to trigger model loading in test

* fix: resolve test failures for CI

- test_main: Fix ConfigManager patch path to use source module
- test_settings_dialog: Mock _is_vosk_model_downloaded and _is_whisper_model_downloaded to skip download flow, add missing dialog attributes
- test_speech_recognition: Replace recognizer with properly configured mock that returns valid JSON, fixing test isolation issues when running all tests together

* fix: mock _download_whisper_model in whisper test to avoid requests exception handling issue

* fix: add gir1.2-girepository-2.0 dep for PyGObject on Ubuntu 24.04

- Add missing girepository-2.0 package for newer Ubuntu runners
- Use --no-build-isolation for PyGObject to use system packages

* fix: skip PyGObject pip install, use system python3-gi package

- Use --no-deps for editable install to skip PyGObject
- Install other deps explicitly without PyGObject
- Add python3-gi-cairo for complete GTK support
- Removes problematic girepository-2.0 build requirement

* fix: install PyGObject via pip with proper build deps

- Remove python3-gi/python3-gi-cairo (doesn't work with setup-python)
- Install PyGObject from pip after installing build dependencies
- Simplify venv setup without --system-site-packages hack

* Fix GObject

* fix: set GI_TYPELIB_PATH for pip-installed PyGObject to find AppIndicator3
2025-12-28 15:29:51 -08:00