# -*- 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           cargo 1.0

github.setup        noworrieseh macdisp 0.2.1 v
github.tarball_from archive
revision            0

categories          sysutils
license             MIT
maintainers         {@noworrieseh github.com:noworrieseh} openmaintainer
platforms           {darwin >= 17}
supported_archs     arm64 x86_64

description         macOS display configuration utility

long_description    macdisp is a Rust implementation of displayplacer with \
                    enhanced features. Configure macOS display settings from \
                    the command line, including resolution, refresh rate, \
                    position, rotation, and mirroring. Includes JSON output \
                    for scripting and MacBook Pro notch management. Uses \
                    DisplayServices private framework when available, with \
                    automatic fallback to CoreGraphics.

homepage            https://github.com/noworrieseh/macdisp

checksums-append    ${distname}${extract.suffix} \
                    rmd160  4e648cfdebf9c7d1618948fecc1ad14c444a1bd6 \
                    sha256  00e8c5d7acb5dbe44e286bf942b4a33378ed58195df3d3dbb071d83e646cccf8 \
                    size    19325

cargo.crates \
    anstream                         0.6.21  43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a \
    anstyle                          1.0.13  5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78 \
    anstyle-parse                    0.2.7  4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2 \
    anstyle-query                    1.1.5  40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc \
    anstyle-wincon                   3.0.11  291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d \
    bitflags                         1.3.2  bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a \
    cc                               1.2.51  7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203 \
    clap                             4.5.53  c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8 \
    clap_builder                     4.5.53  d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00 \
    clap_derive                      4.5.49  2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671 \
    clap_lex                         0.7.6  a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d \
    colorchoice                      1.0.4  b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75 \
    core-foundation                  0.9.4  91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f \
    core-foundation-sys              0.8.7  773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b \
    core-graphics                    0.23.2  c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081 \
    core-graphics-types              0.1.3  45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf \
    find-msvc-tools                  0.1.6  645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff \
    foreign-types                    0.5.0  d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965 \
    foreign-types-macros             0.2.3  1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742 \
    foreign-types-shared             0.3.1  aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b \
    heck                             0.5.0  2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea \
    is_terminal_polyfill             1.70.2  a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695 \
    itoa                             1.0.17  92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2 \
    libc                             0.2.178  37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091 \
    memchr                           2.7.6  f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273 \
    once_cell_polyfill               1.70.2  384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe \
    proc-macro2                      1.0.104  9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0 \
    quote                            1.0.42  a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f \
    serde                            1.0.228  9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e \
    serde_core                       1.0.228  41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad \
    serde_derive                     1.0.228  d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79 \
    serde_json                       1.0.148  3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da \
    shlex                            1.3.0  0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64 \
    strsim                           0.11.1  7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f \
    syn                              2.0.112  21f182278bf2d2bcb3c88b1b08a37df029d71ce3d3ae26168e3c653b213b99d4 \
    unicode-ident                    1.0.22  9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5 \
    utf8parse                        0.2.2  06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821 \
    windows-link                     0.2.1  f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5 \
    windows-sys                      0.61.2  ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc \
    zmij                             1.0.6  aac060176f7020d62c3bcc1cdbcec619d54f48b07ad1963a3f80ce7a0c17755f

# Override cargo build flags to use --offline instead of --frozen
# GitHub release tarballs don't include Cargo.lock
cargo.offline_cmd-replace --frozen --offline

set triplet [expr {${muniversal.build_arch} ne {} ? [option triplet.${muniversal.build_arch}] : {}}]

destroot {
    xinstall -m 0755 ${worksrcpath}/target/${triplet}/release/${name} ${destroot}${prefix}/bin/
}

test.run            yes
test.cmd            ${worksrcpath}/target/${triplet}/release/${name}
test.target
test.args           --version

notes "
macdisp - macOS Display Configuration Utility

Usage Examples:
  ${prefix}/bin/macdisp list                    # List all displays
  ${prefix}/bin/macdisp list --json             # List as JSON
  ${prefix}/bin/macdisp modes 1                 # Show available modes
  ${prefix}/bin/macdisp modes 1 --json          # Show modes as JSON
  ${prefix}/bin/macdisp notch hide              # Hide MacBook Pro notch
  ${prefix}/bin/macdisp notch show              # Show MacBook Pro notch
  ${prefix}/bin/macdisp notch toggle            # Toggle notch visibility

Configure Displays:
  ${prefix}/bin/macdisp \"id:1 res:1920x1080 hz:60 color_depth:8 scaling:on origin:(0,0)\"

Multiple Displays:
  ${prefix}/bin/macdisp \"id:1 res:2560x1440 hz:60 origin:(0,0)\" \\
                        \"id:2 res:1920x1080 hz:60 origin:(2560,0)\"

For more information: https://github.com/noworrieseh/macdisp
"
