voxtype
This commit is contained in:
5 files changed
+2
No files matched your search
@@ -0,0 +1,128 @@
|
||||
_set_default_backend() {
|
||||
# Set the default CPU backend based on CPU capabilities
|
||||
if grep -q avx512f /proc/cpuinfo 2>/dev/null; then
|
||||
ln -sf /usr/lib/voxtype/voxtype-avx512 /usr/bin/voxtype
|
||||
echo "avx512"
|
||||
else
|
||||
ln -sf /usr/lib/voxtype/voxtype-avx2 /usr/bin/voxtype
|
||||
echo "avx2"
|
||||
fi
|
||||
}
|
||||
|
||||
_preserve_or_set_backend() {
|
||||
# Restore saved backend from pre_upgrade, or set default
|
||||
local saved="/tmp/.voxtype-backend-upgrade"
|
||||
if [ -f "$saved" ]; then
|
||||
target=$(cat "$saved")
|
||||
rm -f "$saved"
|
||||
if [ -f "$target" ]; then
|
||||
ln -sf "$target" /usr/bin/voxtype
|
||||
echo "${target##*/voxtype-}"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# No saved state or target gone — set default
|
||||
_set_default_backend
|
||||
}
|
||||
|
||||
_detect_gpu() {
|
||||
# Detect GPU for acceleration recommendation
|
||||
GPU_DETECTED=""
|
||||
GPU_VENDOR=""
|
||||
if [ -d /dev/dri ]; then
|
||||
if ls /dev/dri/renderD* >/dev/null 2>&1; then
|
||||
if command -v lspci >/dev/null 2>&1; then
|
||||
GPU_INFO=$(lspci 2>/dev/null | grep -i 'vga\|3d\|display' | head -1 | sed 's/.*: //')
|
||||
if [ -n "$GPU_INFO" ]; then
|
||||
GPU_DETECTED="$GPU_INFO"
|
||||
case "$GPU_INFO" in
|
||||
*NVIDIA*|*GeForce*|*RTX*|*GTX*) GPU_VENDOR="nvidia" ;;
|
||||
*AMD*|*Radeon*) GPU_VENDOR="amd" ;;
|
||||
*Intel*) GPU_VENDOR="intel" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if [ -z "$GPU_DETECTED" ]; then
|
||||
GPU_DETECTED="GPU detected (install pciutils for details)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$GPU_DETECTED" ]; then
|
||||
echo ""
|
||||
echo " GPU detected: $GPU_DETECTED"
|
||||
echo ""
|
||||
echo " For GPU acceleration, run:"
|
||||
echo " sudo voxtype setup gpu --enable"
|
||||
echo ""
|
||||
if [ "$GPU_VENDOR" = "nvidia" ]; then
|
||||
echo " Whisper: requires vulkan-icd-loader"
|
||||
echo " ONNX engines: requires cuda package"
|
||||
elif [ "$GPU_VENDOR" = "amd" ]; then
|
||||
echo " Whisper: requires vulkan-icd-loader"
|
||||
echo " ONNX engines: requires rocm-hip-runtime"
|
||||
else
|
||||
echo " Requires: vulkan-icd-loader package"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
post_install() {
|
||||
echo ""
|
||||
echo "==> Voxtype Post-installation Steps:"
|
||||
echo ""
|
||||
|
||||
CPU_VARIANT=$(_set_default_backend)
|
||||
echo " CPU backend: $CPU_VARIANT (using voxtype-$CPU_VARIANT)"
|
||||
|
||||
_detect_gpu
|
||||
|
||||
echo ""
|
||||
echo " 1. Add your user to the 'input' group:"
|
||||
echo " sudo usermod -aG input \$USER"
|
||||
echo ""
|
||||
echo " 2. Log out and back in for group changes to take effect"
|
||||
echo ""
|
||||
echo " 3. Download a model:"
|
||||
echo " voxtype setup model"
|
||||
echo ""
|
||||
echo " 4. Start voxtype:"
|
||||
echo " systemctl --user enable --now voxtype"
|
||||
echo ""
|
||||
echo " Optional: Switch to an ONNX engine (Parakeet, SenseVoice, etc.):"
|
||||
echo " voxtype setup onnx --enable"
|
||||
echo ""
|
||||
}
|
||||
|
||||
pre_upgrade() {
|
||||
# Save the current backend so post_upgrade can restore it
|
||||
if [ -L /usr/bin/voxtype ]; then
|
||||
readlink /usr/bin/voxtype > /tmp/.voxtype-backend-upgrade
|
||||
fi
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
echo ""
|
||||
echo "==> Voxtype upgraded to 0.6.6"
|
||||
echo ""
|
||||
|
||||
BACKEND=$(_preserve_or_set_backend)
|
||||
echo " Backend: $BACKEND (using voxtype-$BACKEND)"
|
||||
|
||||
echo ""
|
||||
echo " v0.6.6: Media pause, audio feedback, KDE Plasma support, 7 bug fixes."
|
||||
echo " New: pause_media = true pauses music during recording (MPRIS/playerctl)."
|
||||
echo " New: audio feedback plays when transcription completes."
|
||||
echo " KDE Plasma keybinding docs added to README and user manual."
|
||||
echo " Fixes: ydotool on Fedora, eitype paste mode, duplicate notifications,"
|
||||
echo " xclip on X11, text replacement ordering, remote initial_prompt."
|
||||
echo ""
|
||||
echo " Restart the daemon to apply updates:"
|
||||
echo " systemctl --user restart voxtype"
|
||||
echo ""
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
rm -f /usr/bin/voxtype
|
||||
}
|
||||
Reference in new issue
Block a user