From 483dff4c28cbdcf6306ad8878658466353b2f648 Mon Sep 17 00:00:00 2001 From: goodroot Date: Sat, 6 Sep 2025 17:13:36 -0700 Subject: [PATCH] Prefer user venv in AUR mode; launcher venv lookup --- .SRCINFO | 28 ---------------------------- PKGBUILD | 45 ++++++++++++++++++++++++++++++++------------- hyprwhspr.install | 8 ++------ 3 files changed, 34 insertions(+), 47 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 157519cc82d2..e69de29bb2d1 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,28 +0,0 @@ -pkgbase = hyprwhspr - pkgdesc = Native Whisper speech-to-text for Arch/Omarchy with Waybar integration - pkgver = 1.2.1 - pkgrel = 1 - url = https://github.com/goodroot/hyprwhspr - install = hyprwhspr.install - arch = x86_64 - license = MIT - depends = python - depends = python-numpy - depends = python-scipy - depends = python-pyperclip - depends = python-psutil - depends = python-rich - depends = python-json5 - depends = ydotool - depends = pipewire - depends = pipewire-alsa - depends = pipewire-pulse - depends = pipewire-jack - optdepends = nvidia-utils: For GPU acceleration - optdepends = cuda: For GPU acceleration - 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 diff --git a/PKGBUILD b/PKGBUILD index 2278599f4c36..b13441be6520 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=hyprwhspr pkgver=1.2.1 -pkgrel=1 +pkgrel=2 pkgdesc="Native Whisper speech-to-text for Arch/Omarchy with Waybar integration" arch=('x86_64') url="https://github.com/goodroot/hyprwhspr" @@ -26,7 +26,7 @@ optdepends=( ) install=$pkgname.install source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz") -sha256sums=('357d905dd667b31da5c2f23e4908e0103ea12cb781cb6fff39ee2f08840108dd') +sha256sums=('ac063f5c43da89e89b65230b5a7e70533019ae9274c118c37b62c636ef63cf92') build() { cd "$srcdir/$pkgname-$pkgver" @@ -40,22 +40,34 @@ package() { install -d "$pkgdir/usr/lib/$pkgname" cp -r lib bin scripts config README.md LICENSE requirements.txt "$pkgdir/usr/lib/$pkgname" - # Runtime launcher (uses venv if setup has been run; else system python) + # Runtime launcher (prefers user venv; otherwise 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" "$@" + +# venv lookup order: explicit env → XDG → ~/.local/share → package-dir +if [[ -n "$HYPRWHSPR_VENV" ]]; then + VENV="$HYPRWHSPR_VENV" +elif [[ -n "$XDG_DATA_HOME" && -d "$XDG_DATA_HOME/hyprwhspr/venv" ]]; then + VENV="$XDG_DATA_HOME/hyprwhspr/venv" +elif [[ -d "$HOME/.local/share/hyprwhspr/venv" ]]; then + VENV="$HOME/.local/share/hyprwhspr/venv" +elif [[ -d "$PKG_ROOT/venv" ]]; then + VENV="$PKG_ROOT/venv" +fi + +if [[ -x "$VENV/bin/python" ]]; then + exec "$VENV/bin/python" "$PKG_ROOT/lib/main.py" "$@" else exec python3 "$PKG_ROOT/lib/main.py" "$@" fi EOF chmod 755 "$pkgdir/usr/bin/$pkgname" - # Expose your installer verbatim; users run this after install + # Expose your installer; users run this after install install -m755 "$srcdir/$pkgname-$pkgver/scripts/install-omarchy.sh" \ "$pkgdir/usr/lib/$pkgname/scripts/install-omarchy.sh" @@ -67,15 +79,22 @@ 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 + # 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" + # If you added packaging/systemd, install from there; otherwise copy your config/systemd. + if [[ -f "$srcdir/$pkgname-$pkgver/packaging/systemd/hyprwhspr.service" ]]; then + 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" + else + install -m644 "$srcdir/$pkgname-$pkgver/config/systemd/hyprwhspr.service" \ + "$pkgdir/usr/lib/systemd/user/hyprwhspr.service" + install -m644 "$srcdir/$pkgname-$pkgver/config/systemd/ydotoold.service" \ + "$pkgdir/usr/lib/systemd/user/ydotoold.service" + fi # 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" -} + install -m644 LICENSE "$pkgdi diff --git a/hyprwhspr.install b/hyprwhspr.install index 83ae93640677..f6cabacfb38b 100644 --- a/hyprwhspr.install +++ b/hyprwhspr.install @@ -3,18 +3,14 @@ post_install() { HyprWhspr installed. -Finish setup (runs your same installer, AUR-safe): +Finish setup: 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): +Waybar (optional): • Tray script: /usr/lib/hyprwhspr/config/hyprland/hyprwhspr-tray.sh • To auto-edit Waybar (opt-in), run: HYPRWHSPR_WAYBAR_AUTO=1 hyprwhspr-setup