* 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
155 lines
3.8 KiB
TOML
155 lines
3.8 KiB
TOML
[build-system]
|
|
requires = ["setuptools>=61.0", "wheel"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "vocalinux"
|
|
dynamic = ["version"]
|
|
description = "A seamless voice dictation system for Linux"
|
|
readme = "README.md"
|
|
license = {text = "GPL-3.0"}
|
|
authors = [
|
|
{name = "Jatin K Malik", email = "jatinkrmalik@gmail.com"}
|
|
]
|
|
maintainers = [
|
|
{name = "Jatin K Malik", email = "jatinkrmalik@gmail.com"}
|
|
]
|
|
requires-python = ">=3.8"
|
|
keywords = [
|
|
"voice", "dictation", "speech", "recognition",
|
|
"linux", "accessibility", "voice-typing", "speech-to-text"
|
|
]
|
|
classifiers = [
|
|
"Development Status :: 3 - Alpha",
|
|
"Environment :: X11 Applications :: GTK",
|
|
"Intended Audience :: End Users/Desktop",
|
|
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
"Operating System :: POSIX :: Linux",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.8",
|
|
"Programming Language :: Python :: 3.9",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Topic :: Desktop Environment :: Gnome",
|
|
"Topic :: Multimedia :: Sound/Audio :: Speech",
|
|
"Topic :: Text Processing",
|
|
"Topic :: Utilities",
|
|
]
|
|
dependencies = [
|
|
"vosk>=0.3.45",
|
|
"pydub>=0.25.1",
|
|
"pynput>=1.7.6",
|
|
"evdev>=1.6.0; sys_platform == 'linux'",
|
|
"requests>=2.28.0",
|
|
"tqdm>=4.64.0",
|
|
"numpy>=1.22.0",
|
|
"pyaudio>=0.2.13",
|
|
"python-xlib; sys_platform == 'linux'",
|
|
"PyGObject; sys_platform == 'linux'",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
whisper = [
|
|
"openai-whisper>=20231117",
|
|
"torch>=2.0.0",
|
|
"torchaudio>=2.0.0",
|
|
]
|
|
dev = [
|
|
"pytest>=7.0.0",
|
|
"pytest-cov>=4.0.0",
|
|
"pytest-mock>=3.10.0",
|
|
"black>=23.0.0",
|
|
"isort>=5.12.0",
|
|
"flake8>=6.0.0",
|
|
"pre-commit>=3.0.0",
|
|
"mypy>=1.0.0",
|
|
]
|
|
docs = [
|
|
"sphinx>=6.0.0",
|
|
"sphinx-rtd-theme>=1.2.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
vocalinux = "vocalinux.main:main"
|
|
|
|
[project.gui-scripts]
|
|
vocalinux-gui = "vocalinux.main:main"
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/jatinkrmalik/vocalinux"
|
|
Documentation = "https://github.com/jatinkrmalik/vocalinux/tree/main/docs"
|
|
Repository = "https://github.com/jatinkrmalik/vocalinux"
|
|
Issues = "https://github.com/jatinkrmalik/vocalinux/issues"
|
|
Changelog = "https://github.com/jatinkrmalik/vocalinux/releases"
|
|
|
|
[tool.setuptools]
|
|
packages = ["vocalinux", "vocalinux.speech_recognition", "vocalinux.text_injection", "vocalinux.ui", "vocalinux.utils"]
|
|
package-dir = {"" = "src"}
|
|
|
|
[tool.setuptools.dynamic]
|
|
version = {attr = "vocalinux.version.__version__"}
|
|
|
|
[tool.setuptools.package-data]
|
|
"*" = ["*.svg", "*.wav"]
|
|
|
|
[tool.black]
|
|
line-length = 100
|
|
target-version = ['py38', 'py39', 'py310', 'py311']
|
|
include = '\.pyi?$'
|
|
exclude = '''
|
|
/(
|
|
\.git
|
|
| \.hg
|
|
| \.mypy_cache
|
|
| \.tox
|
|
| \.venv
|
|
| venv
|
|
| _build
|
|
| buck-out
|
|
| build
|
|
| dist
|
|
| node_modules
|
|
)/
|
|
'''
|
|
|
|
[tool.isort]
|
|
profile = "black"
|
|
line_length = 100
|
|
skip_gitignore = true
|
|
skip = [".git", "venv", "node_modules", "build", "dist"]
|
|
|
|
[tool.pytest.ini_options]
|
|
minversion = "7.0"
|
|
addopts = "-ra -q --strict-markers"
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
python_functions = ["test_*"]
|
|
markers = [
|
|
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
"integration: marks tests as integration tests",
|
|
"audio: marks tests that require audio hardware",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
source = ["src"]
|
|
branch = true
|
|
omit = ["*/tests/*", "*/__pycache__/*"]
|
|
|
|
[tool.coverage.report]
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"def __repr__",
|
|
"raise NotImplementedError",
|
|
"if TYPE_CHECKING:",
|
|
"if __name__ == .__main__.:",
|
|
]
|
|
show_missing = true
|
|
|
|
[tool.mypy]
|
|
python_version = "3.8"
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
ignore_missing_imports = true
|
|
exclude = ["venv", "build", "dist", "node_modules"]
|