# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0
PortGroup               github 1.0
PortGroup               makefile 1.0

github.setup            koekeishiya skhd 0.3.9 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball

revision                1

categories              sysutils
maintainers             {@TheKevJames thekev.in:macports} openmaintainer
license                 MIT
description             Simple hotkey daemon for macOS
long_description        skhd is a simple hotkey daemon for macOS that focuses on responsiveness and performance.

checksums               rmd160  81331788ea8332268b3724c75d3578a72cbd9111 \
                        sha256  4a472447f4018a211e192003f4669939501b84633c27a1930689224f6c89e63e \
                        size    26040

patchfiles              patch-makefile.diff

post-destroot {
    # Copy example files
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/examples
    copy {*}[glob ${worksrcpath}/examples/*] \
        ${destroot}${prefix}/share/doc/${name}/examples

    # Install Zsh completion
    xinstall -d -m 0755 ${destroot}${prefix}/share/zsh/site-functions
    xinstall -m 0644 ${filespath}/completion.zsh \
        ${destroot}${prefix}/share/zsh/site-functions/_skhd
}

if {${os.major} < 16} {
    known_fail yes
    pre-fetch {
        ui_error "${name} ${version} cannot build on macOS 10.11 and earlier."
        return -code error "incompatible macOS version"
    }
}

notes "
    A sample configuration is provided at
    * ${prefix}/share/doc/${name}/examples/skhdrc

    You are strongly encouraged to copy this file to
    * ~/.config/${name}/skhdrc
    and adjust it to your needs.

    A common post-install step is to run:
    * skhd --start-service
"
