# Copyright 2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DESCRIPTION="Feature-rich minimalist proximity-based UI for MPV player" HOMEPAGE="https://github.com/tomasklaen/uosc" SRC_URI=" https://github.com/tomasklaen/uosc/releases/download/${PV}/uosc.zip -> ${P}.zip https://github.com/tomasklaen/uosc/releases/download/${PV}/uosc.conf -> ${P}.conf " S="${WORKDIR}" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64" IUSE="+autoload thumbfast" RDEPEND=">=media-video/mpv-0.33.0" PDEPEND="thumbfast? ( mpv-plugin/thumbfast )" RESTRICT="mirror" src_unpack() { mkdir -p "${WORKDIR}/uosc-release" || die cd "${WORKDIR}/uosc-release" || die unzip -q "${DISTDIR}/${P}.zip" || die "Failed to unpack upstream release zip" } src_install() { local mpv_datadir="/usr/share/mpv" local release="${WORKDIR}/uosc-release" insinto "${mpv_datadir}/scripts" doins -r "${release}/scripts/uosc" # The binary inside the zip is not marked executable; fix that explicitly. fperms 0755 "${mpv_datadir}/scripts/uosc/bin/ziggy-linux" # Install the bundled fonts. insinto "${mpv_datadir}/fonts" doins "${release}/fonts/"* # Ship the default config as documentation only. newdoc "${DISTDIR}/${P}.conf" uosc.conf if use autoload; then # Symlink the plugin directory and fonts into /etc/mpv so mpv # picks them up automatically for all users on the system. # We symlink the uosc directory as a whole (safe: it is a # self-contained subtree) and fonts individually (to avoid # replacing the fonts directory itself with a symlink). dosym -r \ "${mpv_datadir}/scripts/uosc" \ "/etc/mpv/scripts/uosc" local font for font in "${ED}/${mpv_datadir}/fonts/"*; do [[ -f "${font}" ]] || continue dosym -r \ "${mpv_datadir}/fonts/${font##*/}" \ "/etc/mpv/fonts/${font##*/}" done fi } pkg_postinst() { local mpv_datadir="/usr/share/mpv" if use autoload; then elog elog "uosc has been symlinked into /etc/mpv and will load automatically" elog "for all users on next mpv launch." elog elog "To customise uosc, copy the reference config to your mpv directory:" elog " mkdir -p ~/.config/mpv/script-opts" elog " cp /usr/share/doc/${PF}/uosc.conf ~/.config/mpv/script-opts/" elog else elog elog "Plugin files are installed under ${mpv_datadir} but are NOT" elog "symlinked into /etc/mpv — mpv will not load uosc automatically." elog elog "To enable uosc system-wide, re-emerge with USE=autoload." elog elog "To enable it for your user only, run:" elog " mkdir -p ~/.config/mpv/scripts ~/.config/mpv/fonts" elog " ln -s ${mpv_datadir}/scripts/${PN} ~/.config/mpv/scripts/${PN}" elog " ln -s ${mpv_datadir}/fonts/* ~/.config/mpv/fonts/" elog elog "Reference config: /usr/share/doc/${PF}/uosc.conf" elog "Copy it to ~/.config/mpv/script-opts/uosc.conf to customise." elog fi if use thumbfast; then elog "Thumbnails: thumbfast is enabled and will be emerged as a dependency." elog "uosc will use it automatically for timeline thumbnail previews." elog else elog "Optional: emerge with USE=thumbfast to enable timeline thumbnail previews." elog fi }