Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable hdr #5

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions EnableHDR.swift
@@ -0,0 +1,26 @@
import Cocoa
import ColorSync
import Foundation

func enableHDR(display: MPDisplay) {
let id = display.displayID
let name = display.displayName ?? ""

guard display.hasHDRModes else {
print("\nThe display does not support HDR control: \(name) [ID: \(id)]")
return
}

display.setPreferHDRModes(true)
}

func main() {
guard let mgr = MPDisplayMgr(), let displays = mgr.displays as? [MPDisplay] else { return }

for display in displays {
enableHDR(display: display)
}

}

main()
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -14,6 +14,7 @@ MONITOR_COMPILER_FLAGS = \

bin/SwapMonitors: SWIFTC_FLAGS=$(MONITOR_COMPILER_FLAGS)
bin/ToggleHDR: SWIFTC_FLAGS=$(MONITOR_COMPILER_FLAGS)
bin/EnableHDR: SWIFTC_FLAGS=$(MONITOR_COMPILER_FLAGS)
bin/RotateDisplay: SWIFTC_FLAGS=$(MONITOR_COMPILER_FLAGS)
bin/HorizontalMonitorLayout: SWIFTC_FLAGS=$(MONITOR_COMPILER_FLAGS)
bin/VerticalMonitorLayout: SWIFTC_FLAGS=$(MONITOR_COMPILER_FLAGS)
Expand Down
Binary file added bin/EnableHDR
Binary file not shown.