# Maintainer: nippy <nippy@tuta.io>

pkgname=raveos-gnome-theme
pkgver=1.0.0
pkgrel=1
pkgdesc="RaveOS GNOME theme payload and installer"
arch=('any')
url="https://raveos.local"
license=('custom')
options=('!debug')
conflicts=('raveos-plasma-theme' 'raveos-hyprland-theme' 'raveos-cosmic-theme')

depends=('raveos-sddm-theme' 'dconf')

optdepends=(
    'fastfetch: terminál üdvözlő (profile.d script indítja)'
)

install="${pkgname}.install"
source=()
sha256sums=()

BUILDDIR="${startdir}/build"
PKGDEST="${startdir}/build"
SRCDEST="${startdir}/build"
SRCPKGDEST="${startdir}/build"
LOGDEST="${startdir}/build"

package() {
    install -dm755 "${pkgdir}/usr/share/themes"
    cp -r --no-preserve=ownership "${startdir}/theme-data/user-themes/Yaru-olive-dark" \
        "${pkgdir}/usr/share/themes/"

    install -dm755 "${pkgdir}/usr/share/icons"
    cp -r --no-preserve=ownership "${startdir}/theme-data/user-icons/Adwaitaru-olive" \
        "${pkgdir}/usr/share/icons/"

    install -Dm644 "${startdir}/theme-data/system/raveos-logo.svg" \
        "${pkgdir}/usr/share/pixmaps/raveos-logo.svg"
    install -Dm644 "${startdir}/theme-data/system/raveos-logo.svg" \
        "${pkgdir}/usr/share/icons/hicolor/scalable/apps/raveos-logo.svg"

    install -Dm644 "${startdir}/theme-data/background" \
        "${pkgdir}/usr/share/backgrounds/raveos/raveos-main-bg.jpeg"

    install -dm755 "${pkgdir}/usr/share/gnome-shell/extensions"
    cp -r --no-preserve=ownership "${startdir}/theme-data/extensions/installed/." \
        "${pkgdir}/usr/share/gnome-shell/extensions/"
    rm -rf "${pkgdir}/usr/share/gnome-shell/extensions/"*@gnome-shell-extensions.gcampax.github.com

    install -Dm755 "${startdir}/theme-data/profile.d/raveos-fastfetch.sh" \
        "${pkgdir}/etc/profile.d/raveos-fastfetch.sh"

    install -Dm644 "${startdir}/dconf-user-profile" \
        "${pkgdir}/etc/dconf/profile/user"
    install -Dm644 "${startdir}/00-raveos" \
        "${pkgdir}/etc/dconf/db/local.d/00-raveos"

    install -Dm644 "${startdir}/99_raveos-gnome.gschema.override" \
        "${pkgdir}/usr/share/glib-2.0/schemas/99_raveos-gnome.gschema.override"

    install -dm755 "${pkgdir}/usr/share/raveos/gnome-theme"
    cp -r --no-preserve=ownership "${startdir}/theme-data" \
        "${pkgdir}/usr/share/raveos/gnome-theme/"

    install -Dm755 "${startdir}/raveos-gnome-apply.sh" \
        "${pkgdir}/usr/lib/raveos-gnome-theme/auto-apply.sh"
    install -Dm644 "${startdir}/raveos-gnome-theme-apply.service" \
        "${pkgdir}/usr/lib/systemd/system/raveos-gnome-theme-apply.service"
}
