Skip to content

Package displayController provides a way to access the low-level monitor API in Windows system to control the display monitor function through DDC/CI, such as brightness, volume, etc

License

gek64/displayController

Repository files navigation

██████╗ ██╗███████╗██████╗ ██╗      █████╗ ██╗   ██╗ ██████╗ ██████╗ ███╗   ██╗████████╗██████╗  ██████╗ ██╗     ██╗     ███████╗██████╗ 
██╔══██╗██║██╔════╝██╔══██╗██║     ██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗████╗  ██║╚══██╔══╝██╔══██╗██╔═══██╗██║     ██║     ██╔════╝██╔══██╗
██║  ██║██║███████╗██████╔╝██║     ███████║ ╚████╔╝ ██║     ██║   ██║██╔██╗ ██║   ██║   ██████╔╝██║   ██║██║     ██║     █████╗  ██████╔╝
██║  ██║██║╚════██║██╔═══╝ ██║     ██╔══██║  ╚██╔╝  ██║     ██║   ██║██║╚██╗██║   ██║   ██╔══██╗██║   ██║██║     ██║     ██╔══╝  ██╔══██╗
██████╔╝██║███████║██║     ███████╗██║  ██║   ██║   ╚██████╗╚██████╔╝██║ ╚████║   ██║   ██║  ██║╚██████╔╝███████╗███████╗███████╗██║  ██║
╚═════╝ ╚═╝╚══════╝╚═╝     ╚══════╝╚═╝  ╚═╝   ╚═╝    ╚═════╝ ╚═════╝ ╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚══════╝╚═╝  ╚═╝

Go Reference

中文说明

  • Call the low-level library of the system to access the display monitor DDC/CI channel and interface
  • Get the display driver information, such as display driver name, current display location
  • Get the value of the current parameter and the range of the current parameters, such as brightness, sharpness, contrast, red, green, blue, and other custom query parameters
  • Set the value of the display parameter, such as brightness, sharpness, contrast, red, green, blue, and other custom settings parameters
  • Interacting with the display, such as setting the displayed input source, controlling the displayed power mode

Install

go get github.com/gek64/displayController

go doc

Example

package main

import (
	"fmt"
	"github.com/gek64/displayController"
	"log"
)

func main() {
	// Get the system display devices
	compositeMonitors, err := displayController.GetCompositeMonitors()
	if err != nil {
		log.Fatal(err)
	}

	// Travel in all display devices one by one
	for i, compositeMonitor := range compositeMonitors {
		fmt.Printf("Monitor No.%d\n", i)
		fmt.Printf("PhysicalInfo:%v\n", compositeMonitor.PhysicalInfo)
		fmt.Printf("SysInfo:%v\n", compositeMonitor.SysInfo)

		// Get the current and maximum value of the brightness parameters of the physical display
		currentValue, _, err := displayController.GetVCPFeatureAndVCPFeatureReply(compositeMonitor.PhysicalInfo.Handle, displayController.Brightness)
		if err != nil {
			log.Println(err)
		}

		// Set the brightness of the current display to current value
		err = displayController.SetVCPFeature(compositeMonitor.PhysicalInfo.Handle, displayController.Brightness, currentValue)
		if err != nil {
			log.Println(err)
		}
	}
}

FAQ

What operating system does this module support?

  • It only supports Windows now, and support systems such as macOS, Linux kernel system and freeBSD will be considered in the future.

Get the display driver parameter normally, but the display monitor parameter cannot be obtained and controlled.

  • This program uses the VESA DDC/CI Display communication standard protocol which release in 1998 to exchange data with physical display monitors. Most of the modern display supports and enables this feature by default, If you encounter this problem, please confirm whether the DDC/CI function has been opened in OSD menu, or contact your display manufacturer to get more relevant information

What other parameters can be customized?

How to find parameters supported by my own display monitor?

  • If the monitor does not support a certain parameter, the error will be returned when calling the command. You can use the error information to determine whether the monitor supports a certain parameter
  • You can use this tool to check which parameters that your monitor supported ControlMyMonitor

My monitor can't find the option to control DDC/CI

  • I've collected some uncommon ways to enable this feature for some well-known monitors, check instructions
  • Please consult the manufacturer of your monitor for instructions

License

  • GPL-3.0 License
  • See LICENSE for details

Credits

About

Package displayController provides a way to access the low-level monitor API in Windows system to control the display monitor function through DDC/CI, such as brightness, volume, etc

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages