# Reference: https://postmarketos.org/uipkg
maintainer="Aster Boese <asterboese@mailbox.org>"
pkgname=postmarketos-ui-niri
pkgver=2
pkgrel=0
pkgdesc="(Wayland) A scrollable-tiling compositor (DOES NOT RUN WITHOUT HW ACCELERATION!)"
url="https://postmarketos.org"
# Blocked by niri
arch="x86_64 aarch64 ppc64le"
license="GPL-3.0-or-later"
depends="
	bluez
	dnsmasq
	elogind
	niri
	polkit-elogind
	postmarketos-base-ui
	postmarketos-base-ui-audio
	postmarketos-base-ui-networkmanager
	xdg-desktop-portal-gtk
	xdg-desktop-portal-wlr
	"
_pmb_recommends="
	dmenu
	foot
	greetd-wlgreet
	postmarketos-artwork-wallpapers
	swaybg
	swayidle
	swaylock
	xwayland
	"
_pmb_groups="seat"
subpackages="$pkgname-openrc $pkgname-systemd"
source="
	niri-greet.kdl
	wlgreet.toml
	greetd-wlgreet.conf
	"
# No tests
options="!check pmb:drm pmb:systemd"

package() {
	# niri configuration for the greeter
	install -Dm644 "$srcdir"/niri-greet.kdl \
		"$pkgdir"/etc/greetd/niri-greet.kdl

	# greetd configuration to start niri
	install -Dm644 "$srcdir"/wlgreet.toml \
		"$pkgdir"/etc/greetd/wlgreet.toml

	# configure greetd.service to use our greetd config
	install -Dm644 "$srcdir"/greetd-wlgreet.conf \
		"$pkgdir"/usr/lib/systemd/system/greetd.service.d/override.conf
}

openrc() {
	install_if="$pkgname=$pkgver-r$pkgrel openrc"
	install="$subpkgname.post-install $subpkgname.post-upgrade"
	depends="
		bluez-openrc
		elogind-openrc
		modemmanager-openrc
		networkmanager-openrc
		seatd-openrc
		"

	mkdir -p "$subpkgdir"
}

sha512sums="
d679d3900904c89381b923a2ca4b92b65b300162d9ca581a2b11c37b34405c89b0b530821282c94067a3ff351642842fd7cee17d3c10c4357663471f57e1e3f8  niri-greet.kdl
49f9c81c2ab7edc5127818de27c5a4fa74cd7fae403afe5bac641ac44132f8d99f0d78e09d2c85d676f30001b201f0ad1b1160becef0b3d0788173f02f9562fa  wlgreet.toml
9c032c47938c0b3e3852e62d94bee0592b3c53ebc9713419fad725cc43b77f707487a5a5a677e92f6ce156a70fd55147ab239148e55aeb188d9b9b8aaec63760  greetd-wlgreet.conf
"
