bump for saner aur

This commit is contained in:
goodroot 2025-09-06 17:04:54 -07:00
parent 9bb5e2dcb2
commit 96b1efbd5f
3 changed files with 118 additions and 137 deletions

View file

@ -1,13 +1,12 @@
pkgbase = hyprwhspr
pkgdesc = Native Whisper speech-to-text for Arch/Omarchy with Waybar integration
pkgver = 1.2.0
pkgrel = 10
pkgver = 1.2.1
pkgrel = 1
url = https://github.com/goodroot/hyprwhspr
install = hyprwhspr.install
arch = x86_64
license = MIT
depends = python
depends = python-evdev
depends = python-numpy
depends = python-scipy
depends = python-pyperclip
@ -19,13 +18,11 @@ pkgbase = hyprwhspr
depends = pipewire-alsa
depends = pipewire-pulse
depends = pipewire-jack
depends = cmake
depends = make
depends = git
depends = base-devel
optdepends = nvidia-utils: For GPU acceleration
optdepends = cuda: For GPU acceleration
source = hyprwhspr-1.2.0.tar.gz::https://github.com/goodroot/hyprwhspr/archive/v1.2.0.tar.gz
sha256sums = ac063f5c43da89e89b65230b5a7e70533019ae9274c118c37b62c636ef63cf92
optdepends = waybar: For tray/status
optdepends = whisper.cpp: Use system build instead of building locally in setup step
source = hyprwhspr-1.2.1.tar.gz::https://github.com/goodroot/hyprwhspr/archive/refs/tags/v1.2.1.tar.gz
sha256sums = 357d905dd667b31da5c2f23e4908e0103ea12cb781cb6fff39ee2f08840108dd
pkgname = hyprwhspr

148
PKGBUILD
View file

@ -1,107 +1,81 @@
# Maintainer: goodroot <hyprwhspr@goodroot.ca>
pkgname=hyprwhspr
pkgver=1.2.0
pkgrel=10
pkgver=1.2.1
pkgrel=1
pkgdesc="Native Whisper speech-to-text for Arch/Omarchy with Waybar integration"
arch=('x86_64')
url="https://github.com/goodroot/hyprwhspr"
license=('MIT')
depends=(
'python'
'python-evdev'
'python-numpy'
'python-scipy'
'python-pyperclip'
'python-psutil'
'python-rich'
'python-json5'
'ydotool'
'pipewire'
'pipewire-alsa'
'pipewire-pulse'
'pipewire-jack'
'cmake'
'make'
'git'
'base-devel'
'python'
'python-numpy'
'python-scipy'
'python-pyperclip'
'python-psutil'
'python-rich'
'python-json5'
'ydotool'
'pipewire' 'pipewire-alsa' 'pipewire-pulse' 'pipewire-jack'
)
makedepends=()
optdepends=(
'nvidia-utils: For GPU acceleration'
'cuda: For GPU acceleration'
)
install="${pkgname}.install"
source=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/goodroot/${pkgname}/archive/v${pkgver}.tar.gz"
)
sha256sums=(
'ac063f5c43da89e89b65230b5a7e70533019ae9274c118c37b62c636ef63cf92'
'nvidia-utils: For GPU acceleration'
'cuda: For GPU acceleration'
'waybar: For tray/status'
'whisper.cpp: Use system build instead of building locally in setup step'
)
install=$pkgname.install
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('357d905dd667b31da5c2f23e4908e0103ea12cb781cb6fff39ee2f08840108dd')
build() {
cd "$srcdir/$pkgname-$pkgver"
# nothing to build; user runs hyprwhspr-setup post-install
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
# Create installation directory
install -dm755 "${pkgdir}/opt/${pkgname}"
# Copy all source files to /opt/hyprwhspr
cp -r . "${pkgdir}/opt/${pkgname}/"
# Make scripts executable
chmod +x "${pkgdir}/opt/${pkgname}/scripts/"*.sh
chmod +x "${pkgdir}/opt/${pkgname}/bin/hyprwhspr"
# Fix the launcher script to use venv python directly
cat > "${pkgdir}/opt/${pkgname}/bin/hyprwhspr" << 'EOF'
#!/bin/bash
cd "$srcdir/$pkgname-$pkgver"
# HyprWhspr - Hyprland-optimized voice dictation application
# Main launcher script
# Payload into /usr/lib keeps repo layout intact for your installer
install -d "$pkgdir/usr/lib/$pkgname"
cp -r lib bin scripts config README.md LICENSE requirements.txt "$pkgdir/usr/lib/$pkgname"
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PACKAGE_ROOT="$(dirname "$SCRIPT_DIR")"
# Set environment variables
export HYPRWHSPR_ROOT="$PACKAGE_ROOT"
export PYTHONPATH="$PACKAGE_ROOT/lib:$PYTHONPATH"
# Use virtual environment's python directly if it exists
if [ -f "$PACKAGE_ROOT/venv/bin/python" ]; then
exec "$PACKAGE_ROOT/venv/bin/python" "$PACKAGE_ROOT/lib/main.py" "$@"
# Runtime launcher (uses venv if setup has been run; else system python)
install -d "$pkgdir/usr/bin"
cat > "$pkgdir/usr/bin/$pkgname" << 'EOF'
#!/usr/bin/env bash
PKG_ROOT="/usr/lib/hyprwhspr"
export HYPRWHSPR_ROOT="$PKG_ROOT"
export PYTHONPATH="$PKG_ROOT/lib${PYTHONPATH:+:$PYTHONPATH}"
if [[ -x "$PKG_ROOT/venv/bin/python" ]]; then
exec "$PKG_ROOT/venv/bin/python" "$PKG_ROOT/lib/main.py" "$@"
else
# Fallback to system python
exec python3 "$PACKAGE_ROOT/lib/main.py" "$@"
exec python3 "$PKG_ROOT/lib/main.py" "$@"
fi
EOF
chmod +x "${pkgdir}/opt/${pkgname}/bin/hyprwhspr"
# Create Python virtual environment and install ALL dependencies
cd "${pkgdir}/opt/${pkgname}"
python -m venv venv
# Use the venv's python directly to avoid path issues
./venv/bin/python -m pip install --upgrade pip
# Install all Python dependencies in venv for self-contained environment
./venv/bin/python -m pip install numpy scipy pyperclip psutil rich json5 sounddevice evdev
# Create symlink for easy access
install -dm755 "${pkgdir}/usr/bin"
ln -sf "/opt/${pkgname}/bin/hyprwhspr" "${pkgdir}/usr/bin/hyprwhspr"
# Copy documentation
install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# Create user config template
install -dm755 "${pkgdir}/etc/skel/.config/${pkgname}"
cat > "${pkgdir}/etc/skel/.config/${pkgname}/config.json" << 'EOF'
{
"primary_shortcut": "SUPER+ALT+D",
"model": "base.en",
"audio_feedback": true,
"start_sound_volume": 0.3,
"stop_sound_volume": 0.3
}
chmod 755 "$pkgdir/usr/bin/$pkgname"
# Expose your installer verbatim; users run this after install
install -m755 "$srcdir/$pkgname-$pkgver/scripts/install-omarchy.sh" \
"$pkgdir/usr/lib/$pkgname/scripts/install-omarchy.sh"
# Convenience wrapper → AUR mode
cat > "$pkgdir/usr/bin/hyprwhspr-setup" << 'EOF'
#!/usr/bin/env bash
export HYPRWHSPR_AUR_INSTALL=1
exec /usr/lib/hyprwhspr/scripts/install-omarchy.sh "$@"
EOF
chmod 755 "$pkgdir/usr/bin/hyprwhspr-setup"
# Ship **AUR-friendly** user units so users can enable them directly
install -d "$pkgdir/usr/lib/systemd/user"
install -m644 "$srcdir/$pkgname-$pkgver/packaging/systemd/hyprwhspr.service" \
"$pkgdir/usr/lib/systemd/user/hyprwhspr.service"
install -m644 "$srcdir/$pkgname-$pkgver/packaging/systemd/ydotoold.service" \
"$pkgdir/usr/lib/systemd/user/ydotoold.service"
# Docs & license
install -d "$pkgdir/usr/share/doc/$pkgname" "$pkgdir/usr/share/licenses/$pkgname"
install -m644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
install -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

View file

@ -1,47 +1,57 @@
post_install() {
echo "HyprWhspr has been installed to /opt/hyprwhspr/"
echo ""
echo "Running automatic setup..."
# Run the installation script automatically
if [ -f "/opt/hyprwhspr/scripts/install-omarchy.sh" ]; then
echo "Executing installation script..."
cd /opt/hyprwhspr
./scripts/install-omarchy.sh
echo ""
echo "✅ HyprWhspr setup completed successfully!"
echo ""
echo "⚠️ IMPORTANT: Log out and back in to ensure proper permissions"
echo " Then use Super+Alt+D to start dictation!"
else
echo "❌ Installation script not found. Please run manually:"
echo " /opt/hyprwhspr/scripts/install-omarchy.sh"
fi
echo ""
echo "See GitHub for more information."
echo " https://github.com/goodroot/hyprwhspr/"
cat <<'EOF'
HyprWhspr installed.
Finish setup (runs your same installer, AUR-safe):
hyprwhspr-setup
Enable the user services:
systemctl --user enable --now ydotoold.service
systemctl --user enable --now hyprwhspr.service
Notes:
• ydotoold runs as a user service here. Your installer also adds a udev rule
and input/audio groups so it can run unprivileged.
Waybar (optional; NOT auto-edited in AUR mode):
• Tray script: /usr/lib/hyprwhspr/config/hyprland/hyprwhspr-tray.sh
• To auto-edit Waybar (opt-in), run:
HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup
Config:
The setup will create/update:
~/.config/hyprwhspr/config.json
Troubleshooting:
journalctl --user -u ydotoold.service
journalctl --user -u hyprwhspr.service
EOF
}
post_upgrade() {
echo "HyprWhspr has been upgraded successfully!"
echo ""
echo "Re-running setup to update configuration..."
# Re-run the installation script to update components
if [ -f "/opt/hyprwhspr/scripts/install-omarchy.sh" ]; then
echo "Updating whisper.cpp and dependencies..."
cd /opt/hyprwhspr
./scripts/install-omarchy.sh
echo ""
echo "✅ HyprWhspr update completed successfully!"
else
echo "❌ Installation script not found. Please run manually:"
echo " /opt/hyprwhspr/scripts/install-omarchy.sh"
fi
echo ""
echo "See GitHub for more information."
echo " https://github.com/goodroot/hyprwhspr/"
cat <<'EOF'
HyprWhspr upgraded.
If needed, re-run setup (idempotent):
hyprwhspr-setup
Service status:
systemctl --user status ydotoold.service
systemctl --user status hyprwhspr.service
EOF
}
post_remove() {
cat <<'EOF'
HyprWhspr removed.
Note: user data remains (remove manually if desired):
~/.config/hyprwhspr
EOF
}