# Copyright 2023-2026 Gentoo Authors
# Distributed under the terms of the MIT License

EAPI=8

DESCRIPTION="xprop for Hyprland"
HOMEPAGE="https://github.com/vilari-mickopf/hyprprop"

COMMIT="80de2f89ba0e66fad406a5834d367632d5922609"

if [[ "${PV}" = *9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/vilari-mickopf/${PN^}.git"
else
	SRC_URI="https://github.com/vilari-mickopf/${PN^}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/${PN}-${COMMIT}"

	KEYWORDS="~amd64"
fi

LICENSE="MIT"
SLOT="0"

RDEPEND="
	app-misc/hyprevents
	app-misc/jq
	gui-wm/hyprland
	gui-apps/slurp
"
DEPEND="${RDEPEND}"

src_prepare() {
	default

	# The makefile replaces the dirname of certain scripts to hardcode the
	# share directory. It does not work with emake, therefore replaces it by
	# the real path name.
	sed -i '/@sed/s|$(SHAREDIR)|/usr/share/hyprprop|' Makefile || die
}

src_compile() {
	:
}

src_install() {
	emake PREFIX="${D}/usr" DESTDIR="${D}" install
}