pkgname=hyprshell-slim
# x-release-please-start-version
pkgver=4.8.3
# x-release-please-end
pkgrel=1
pkgdesc="A modern GTK4-based window switcher and application launcher for Hyprland (lightweight version)"
arch=('x86_64' 'aarch64')
conflicts=('hyprshell')
provides=('hyprshell')
url="https://github.com/h3rmt/hyprshell/"
license=("MIT")
makedepends=('cargo')
depends=('hyprland' 'gtk4-layer-shell' 'gtk4' 'gcc' 'pixman' 'libadwaita')
source=("hyprshell-$pkgver.tar.gz::https://static.crates.io/crates/hyprshell/hyprshell-$pkgver.crate")

prepare() {
    export RUSTUP_TOOLCHAIN=stable
    cd "hyprshell-$pkgver"
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cd "hyprshell-$pkgver"
    cargo build --frozen --release --no-default-features --features=slim
}

package() {
    install -Dm755 "hyprshell-$pkgver/target/release/hyprshell" "$pkgdir/usr/bin/hyprshell"
    install -Dm644 "hyprshell-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/hyprshell/LICENSE"

    "$pkgdir/usr/bin/hyprshell" completions bash -p "$pkgdir/usr/share/bash-completion/completions"
    "$pkgdir/usr/bin/hyprshell" completions fish -p "$pkgdir/usr/share/fish/vendor_completions.d"
    "$pkgdir/usr/bin/hyprshell" completions zsh -p "$pkgdir/usr/share/zsh/site-functions"
}
