Inside the snap, list the sound server's capture sources with pactl and record from the chosen one by scoping PULSE_SOURCE to each PortAudio open (serialized behind one lock). Settings saves the stable source name, keeps each dropdown entry's server name so selection never queries the server from the GTK thread, and the snap reports whisper.cpp as CPU-only instead of probing host GPU tools. Fixes #1011
165 lines
7.7 KiB
YAML
165 lines
7.7 KiB
YAML
# Vocalinux Snap packaging
|
|
#
|
|
# First ship: strict confinement, default whisper.cpp engine path, GTK tray UI,
|
|
# mic capture, model download, and text injection (RemoteDesktop portal, wtype, xdotool).
|
|
# Informed by issue #48 and packaging/flatpak lessons on feat/flatpak-packaging.
|
|
#
|
|
# Build (from repo root, with snapcraft + LXD or Multipass):
|
|
# snapcraft pack
|
|
# See docs/INSTALL.md for pack and store upload steps.
|
|
|
|
name: vocalinux
|
|
base: core24 # Ubuntu 24.04 / Python 3.12 (project requires-python >=3.11)
|
|
# Fallback version; live version is set from src/vocalinux/version.py via
|
|
# adopt-info + craftctl set in the vocalinux part (required for craftctl).
|
|
version: "0.17.0"
|
|
adopt-info: vocalinux
|
|
summary: Free offline voice dictation for Linux
|
|
description: |
|
|
Vocalinux is free voice typing for Linux. Hold a shortcut or toggle dictation, and text lands in almost any app on X11 or Wayland.
|
|
|
|
Speech recognition runs on your machine after you download a model. No Voca account. No cloud transcription on the default path.
|
|
|
|
This snap ships the whisper.cpp engine plus VOSK. The optional OpenAI Whisper / PyTorch stack is not bundled (too large for the snap).
|
|
|
|
Features:
|
|
- System tray control and GTK settings
|
|
- Offline dictation (models download on first use)
|
|
- Microphone capture and short feedback tones
|
|
- Text injection via the Wayland RemoteDesktop portal, wtype, or xdotool
|
|
|
|
Sandbox notes:
|
|
- Global hotkeys need: sudo snap connect vocalinux:raw-input
|
|
and sudo snap connect vocalinux:hardware-observe
|
|
- Native Wayland typing uses the RemoteDesktop portal: the compositor
|
|
asks once on first dictation. The snap ships no uinput plug and no
|
|
ydotool; the Store denied the super-privileged grant.
|
|
- KDE Plasma: KWin's portal can mistype letter case (KDE bug 489021);
|
|
set "Virtual Keyboard = IBus Wayland" so the IBus path delivers text.
|
|
- Microphone may need: sudo snap connect vocalinux:audio-record
|
|
The microphone list comes from the sound server, so pick a device
|
|
in Settings rather than relying on the system default.
|
|
- whisper.cpp runs on the CPU in this snap; it has no GPU backend.
|
|
For Vulkan acceleration install the AppImage or use install.sh.
|
|
- Config and models live under ~/snap/vocalinux/
|
|
|
|
grade: stable
|
|
confinement: strict
|
|
license: AGPL-3.0-only
|
|
icon: snap/gui/vocalinux.png
|
|
contact: https://github.com/VocaHQ/vocalinux/issues
|
|
issues: https://github.com/VocaHQ/vocalinux/issues
|
|
website: https://vocalinux.com
|
|
source-code: https://github.com/VocaHQ/vocalinux
|
|
donation: https://github.com/sponsors/jatinkrmalik
|
|
|
|
apps:
|
|
vocalinux:
|
|
command: bin/vocalinux
|
|
extensions: [gnome]
|
|
plugs:
|
|
# gnome extension already grants desktop, desktop-legacy, gsettings,
|
|
# opengl, wayland, x11, unity7 (tray / indicators).
|
|
- audio-record # microphone (may require manual connect)
|
|
- audio-playback # start/stop feedback tones (PipeWire-pulse / PulseAudio)
|
|
- home # optional access outside snap HOME (shared files)
|
|
- network # download speech models on first run
|
|
- network-bind # optional remote_api engine
|
|
# Global hotkeys via python-evdev (/dev/input/event*).
|
|
# Super-privileged: not auto-connected; user must:
|
|
# sudo snap connect vocalinux:raw-input
|
|
- raw-input
|
|
# Needed for /proc/bus/input/devices; not auto-connected:
|
|
# sudo snap connect vocalinux:hardware-observe
|
|
- hardware-observe
|
|
# No uinput plug; the RemoteDesktop portal types on Wayland instead.
|
|
# The Store denied the super-privileged grant
|
|
# (https://forum.snapcraft.io/t/53528), and ydotool is not staged
|
|
# because it cannot reach /dev/uinput under confinement.
|
|
common-id: com.vocalinux.Vocalinux
|
|
desktop: usr/share/applications/vocalinux.desktop
|
|
environment:
|
|
# Prefer bundled CLI helpers (xdotool, xsel, xclip, wl-copy).
|
|
# Do NOT prepend $SNAP/usr/lib over the gnome extension platform path:
|
|
# that loads a second GLib/GTK and segfaults on `from gi.repository import Gtk`.
|
|
PATH: $SNAP/usr/bin:$SNAP/bin:$PATH
|
|
# PortAudio opens ALSA first. Point at snap-local config that routes to Pulse.
|
|
ALSA_CONFIG_PATH: $SNAP/etc/asound.conf
|
|
# core24 gnome-46-2404: desktop-launch rebuilds gdk-pixbuf-loaders.cache
|
|
# by running query-loaders, which picks the SVG loader from the first
|
|
# LD_LIBRARY_PATH entry ending in /$CRAFT_ARCH_TRIPLET. Stage-packages
|
|
# (via libavcodec and friends) put a gdk-pixbuf tree without
|
|
# libpixbufloader_svg.so at $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET, ahead of
|
|
# gnome-platform. About page and other GdkPixbuf SVG loads then fail
|
|
# with "Image type svg is not supported".
|
|
# https://forum.snapcraft.io/t/missing-svg-support-for-gtk3-in-core24/48851
|
|
LD_LIBRARY_PATH: $SNAP/gnome-platform/usr/lib/$CRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH
|
|
|
|
# Make ALSA data/plugins visible at the paths libasound expects.
|
|
layout:
|
|
/usr/share/alsa:
|
|
bind: $SNAP/usr/share/alsa
|
|
/usr/lib/$CRAFT_ARCH_TRIPLET/alsa-lib:
|
|
bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/alsa-lib
|
|
|
|
parts:
|
|
vocalinux:
|
|
plugin: python
|
|
source: .
|
|
source-type: local
|
|
build-environment:
|
|
- PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
|
# pywhispercpp's PyPI wheel ships a libggml-cpu compiled for AVX2+FMA,
|
|
# which dies with SIGILL at model load on pre-Haswell CPUs (#957), so
|
|
# the pinned sdist is built instead of installing that wheel.
|
|
# GGML_NATIVE=OFF alone is not the portable baseline either: while
|
|
# ggml's native default is on it turns every GGML_* SIMD option on, so
|
|
# each one is pinned off for the plain x86-64 baseline.
|
|
- PIP_NO_BINARY: pywhispercpp
|
|
- CMAKE_ARGS: "-DGGML_NATIVE=OFF -DGGML_SSE42=OFF -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_BMI2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF"
|
|
build-packages:
|
|
- build-essential
|
|
- cmake
|
|
- git
|
|
- pkg-config
|
|
- portaudio19-dev
|
|
- libgirepository1.0-dev
|
|
- libcairo2-dev
|
|
- python3-dev
|
|
- libdbus-1-dev
|
|
stage-packages:
|
|
# Only extras not provided by the gnome-46-2404 platform content snap.
|
|
# Staging GTK/GLib/AppIndicator here duplicates the platform and can crash GI.
|
|
- libportaudio2
|
|
- libasound2t64 # Ubuntu 24.04 / core24 name for libasound2
|
|
- libasound2-data
|
|
- libasound2-plugins # pcm/ctl pulse → host PulseAudio/PipeWire
|
|
- pulseaudio-utils # paplay for start/stop UI sounds; pactl lists microphones
|
|
- xdotool
|
|
- wtype # virtual-keyboard protocol (GNOME often rejects this)
|
|
- x11-utils # xprop for XWayland WM_CLASS
|
|
- xsel
|
|
- xclip
|
|
- wl-clipboard
|
|
python-packages:
|
|
- pip
|
|
- setuptools
|
|
- wheel
|
|
override-pull: |
|
|
craftctl default
|
|
version="$(python3 -c "import pathlib, re; t = pathlib.Path('${CRAFT_PART_SRC}/src/vocalinux/version.py').read_text(); m = re.search(r'__version__\\s*=\\s*[\\'\"]([^\\'\"]+)', t); assert m, 'version not found'; print(m.group(1))")"
|
|
craftctl set version="$version"
|
|
# PyGObject/GI provided by gnome extension.
|
|
sed -i '/^[[:space:]]*"PyGObject/d' "${CRAFT_PART_SRC}/pyproject.toml"
|
|
override-build: |
|
|
craftctl default
|
|
install -Dm644 "${CRAFT_PROJECT_DIR}/snap/gui/vocalinux.desktop" \
|
|
"${CRAFT_PART_INSTALL}/usr/share/applications/vocalinux.desktop"
|
|
install -Dm644 "${CRAFT_PROJECT_DIR}/resources/icons/scalable/vocalinux.svg" \
|
|
"${CRAFT_PART_INSTALL}/usr/share/icons/hicolor/scalable/apps/vocalinux.svg"
|
|
# meta/gui is what snapd uses for the store/desktop icon when present.
|
|
install -Dm644 "${CRAFT_PROJECT_DIR}/resources/icons/scalable/vocalinux.svg" \
|
|
"${CRAFT_PART_INSTALL}/meta/gui/icon.svg"
|
|
install -Dm644 "${CRAFT_PROJECT_DIR}/snap/local/alsa/asound.conf" \
|
|
"${CRAFT_PART_INSTALL}/etc/asound.conf"
|