██████╗ ██╗███████╗██████╗ ██╗ █████╗ ██╗ ██╗ ██████╗ ██████╗ ███╗ ██╗████████╗██████╗ ██████╗ ██╗ ██╗ ███████╗██████╗
██╔══██╗██║██╔════╝██╔══██╗██║ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██╔══██╗██╔═══██╗██║ ██║ ██╔════╝██╔══██╗
██║ ██║██║███████╗██████╔╝██║ ███████║ ╚████╔╝ ██║ ██║ ██║██╔██╗ ██║ ██║ ██████╔╝██║ ██║██║ ██║ █████╗ ██████╔╝
██║ ██║██║╚════██║██╔═══╝ ██║ ██╔══██║ ╚██╔╝ ██║ ██║ ██║██║╚██╗██║ ██║ ██╔══██╗██║ ██║██║ ██║ ██╔══╝ ██╔══██╗
██████╔╝██║███████║██║ ███████╗██║ ██║ ██║ ╚██████╗╚██████╔╝██║ ╚████║ ██║ ██║ ██║╚██████╔╝███████╗███████╗███████╗██║ ██║
╚═════╝ ╚═╝╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝
- 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
go get github.com/gek64/displayController
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)
}
}
}
- 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 theDDC/CI
function has been opened in OSD menu, or contact your display manufacturer to get more relevant information
- Please refer to the following articles to get more custom parameters
- https://www.ddcutil.com/vcpinfo_output/
- https://www.hattelandtechnology.com/hubfs/pdf/misc/doc101681-1_8_and_13inch_dis_ddc_control.pdf
- 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
- 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
- GPL-3.0 License
- See
LICENSE
for details