# Copyright 2024-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..13} )
inherit python-single-r1 desktop xdg

DESCRIPTION="Desktop application for managing systemd services"
HOMEPAGE="https://github.com/mfat/systemd-pilot"
SRC_URI="https://github.com/mfat/systemd-pilot/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

RDEPEND="
	${PYTHON_DEPS}
	$(python_gen_cond_dep '
		dev-python/pygobject:3[${PYTHON_USEDEP}]
		dev-python/keyring[${PYTHON_USEDEP}]
		dev-python/paramiko[${PYTHON_USEDEP}]
		dev-python/rich[${PYTHON_USEDEP}]
	')
	x11-libs/gtk+:3[introspection]
	x11-libs/gtksourceview:4[introspection]
"
DEPEND="${RDEPEND}"

src_install() {
	python_newscript src/main.py "${PN}"

	insinto /usr/share/metainfo
	doins io.github.mfat.systemdpilot.metainfo.xml

	newicon -s scalable io.github.mfat.systemdpilot.svg io.github.mfat.systemdpilot.svg
	newicon systemd-pilot.png io.github.mfat.systemdpilot.png

	domenu data/io.github.mfat.systemdpilot.desktop
}