Example #1
0
func (display Display) SetBrightness(value float64) {
	doWithBrightness(func(key *C.char) {
		C.IODisplaySetFloatParameter(
			C.CGDisplayIOServicePort(C.CGDirectDisplayID(display.id)),
			C.kNilOptions,
			C.CFStringCreateWithCString(nil, key, C.kCFStringEncodingMacRoman),
			C.float(value))
	})
}
Example #2
0
func (display Display) Brightness() float64 {
	value := C.float(0.0)

	doWithBrightness(func(key *C.char) {
		C.IODisplayGetFloatParameter(
			C.CGDisplayIOServicePort(C.CGDirectDisplayID(display.id)),
			C.kNilOptions,
			C.CFStringCreateWithCString(nil, key, C.kCFStringEncodingMacRoman),
			&value)
	})

	return float64(value)
}