feat: display module — brightness and power control over DDC/CI - #18
Merged
Conversation
adds `smctl display list | brightness | power` for external displays on Apple Silicon, via the private IOAVService I2C interface. The DDC layer is vendored from m1ddc (MIT, waydabber) and converted from Objective-C to plain C/CoreFoundation so SwiftPM builds it without ARC bridging. `power off` uses VCP 0xD6 (soft off): the panel powers down and drops signal, but stays in the macOS layout, so windows are not rearranged and it can be woken back over DDC. A true layout disconnect (CGSConfigureDisplayEnabled) was tested and rejected: it is a one-way door that survives replug and sleep, recoverable only by resetting the WindowServer display plists and rebooting. main.swift is renamed to SMCtl.swift because @main cannot coexist with a file named main.swift once the target has more than one source file.
🤖 LeoCode Review⏳ 等待审查... 最后更新: 2026-07-03 18:17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
smctl displaycommand group for external displays on Apple Silicon:list [--json],brightness [0-100] [--display <index|uuid>] [--json],power on|off [--display …]DisplayDDCC target: DDC/CI over the private IOAVService I2C interface, vendored from m1ddc (MIT) and converted from Objective-C to plain C/CoreFoundationpower off= VCP 0xD6 soft-off: panel drops signal but stays in the macOS layout (no window rearrangement) and wakes back over DDCmain.swift→SMCtl.swiftrename (Swift forbids@mainalongside amain.swiftin a multi-file target)Why not a true layout disconnect
CGSConfigureDisplayEnabled(displayplacer route) was tested on this machine and is a one-way door: the disabled display disappears from every layer (CG, IOKit, BetterDisplay), survives replug and full sleep, and only comes back after deleting the WindowServer display plists and rebooting. Documented in project memory; deliberately not shipped.Test plan