aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 959e6f95e4ee6a8ad48eca0caa72a3ba232a27fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Maintainer: delta-whiplash <delta@delta-net.ovh>

# -------------------------------------------------------------------
# Naming convention:
#   pkgname  = openwhispr-appimage  (AUR / pacman convention: lowercase)
#   _appname = OpenWhispr           (upstream asset naming: PascalCase)
#   Asset:   OpenWhispr-${pkgver}-linux-x86_64.AppImage
# -------------------------------------------------------------------
pkgname=openwhispr-appimage
_appname=OpenWhispr
pkgver=1.8.3
pkgrel=1
pkgdesc="Voice-to-text dictation app with local Whisper/Parakeet and cloud models (AppImage)"
arch=('x86_64')
url="https://github.com/${_appname}/${pkgname%-appimage}"
license=('MIT')
depends=('fuse2')
optdepends=('ydotool: Input automation tool for Wayland paste'
            'ydotoold: Daemon for ydotool (auto-paste support, on Ubuntu/Pop!_OS: sudo apt install ydotoold)'
            'xclip: Clipboard tool for KDE Wayland paste'
            'xsel: Alternative clipboard tool for Wayland paste'
            'wl-clipboard: Wayland clipboard utilities (wl-copy)'
            'xdotool: X11 automation for paste simulation'
            'wtype: Wayland input tool for wlroots compositors (Sway, etc.)'
            'procps-ng: For pidof utility (process detection)'
            'libpulse: For pactl (audio detection in meetings)'
            'hyprland: For hyprctl (Hyprland shortcuts)'
            'qt6-tools: For qdbus/qdbus6 (KDE shortcuts)'
            'systemd: For journalctl (KDE integration)')
provides=('openwhispr')
conflicts=('openwhispr')
options=('!strip')

# AppImage asset URL — the only source needed
source=("${_appname}-${pkgver}-linux-x86_64.AppImage::https://github.com/${_appname}/openwhispr/releases/download/v${pkgver}/${_appname}-${pkgver}-linux-x86_64.AppImage")
sha256sums=('fe90648d221634962bee2b6dc954d5781590cd9d345f412489e7e324d41767ce')

prepare() {
    chmod +x "${_appname}-${pkgver}-linux-x86_64.AppImage"

    # Extract the AppImage squashfs content without running it
    # --appimage-extract dumps to squashfs-root/ in $srcdir
    "./${_appname}-${pkgver}-linux-x86_64.AppImage" --appimage-extract
}

package() {
    # ---- AppImage binary ----------------------------------------
    install -Dm755 "${_appname}-${pkgver}-linux-x86_64.AppImage" \
        "${pkgdir}/opt/${pkgname}/${pkgname}.AppImage"

    # Wrapper script in PATH so the user can launch with `openwhispr`
    install -dm755 "${pkgdir}/usr/bin"
    cat > "${pkgdir}/usr/bin/openwhispr" <<'EOF'
#!/bin/sh
exec /opt/openwhispr-appimage/openwhispr-appimage.AppImage "$@"
EOF
    chmod 755 "${pkgdir}/usr/bin/openwhispr"

    # ---- .desktop file ------------------------------------------
    # Electron AppImages embed the .desktop at squashfs-root/<appname>.desktop
    local _desktop
    _desktop="${srcdir}/squashfs-root/open-whispr.desktop"

    if [[ -f "$_desktop" ]]; then
        # Fix the Exec path to use our wrapper
        sed -i "s|^Exec=.*|Exec=/usr/bin/openwhispr %U|" "$_desktop"
        install -Dm644 "$_desktop" \
            "${pkgdir}/usr/share/applications/${pkgname}.desktop"
    fi

    # ---- Icon ---------------------------------------------------
    # Electron AppImages typically ship icons at:
    #   squashfs-root/usr/share/icons/hicolor/<size>/apps/<name>.png
    # or a single icon at squashfs-root/<name>.png
    find "${srcdir}/squashfs-root/usr/share/icons" -name "*.png" 2>/dev/null \
    | while read -r icon; do
        # Preserve the hicolor tree structure
        local rel="${icon#${srcdir}/squashfs-root/usr/share/icons/}"
        install -Dm644 "$icon" "${pkgdir}/usr/share/icons/${rel}"
    done

    # Fallback: top-level icon
    if [[ -f "${srcdir}/squashfs-root/${_appname,,}.png" ]]; then
        install -Dm644 "${srcdir}/squashfs-root/${_appname,,}.png" \
            "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
    fi

    # ---- License ------------------------------------------------
    local _license
    _license=$(find "${srcdir}/squashfs-root" -maxdepth 2 -name "LICENSE*" | head -n1)
    [[ -n "$_license" ]] && install -Dm644 "$_license" \
        "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}