moncon

package module
v0.0.0-...-66b8d2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 8 Imported by: 0

README

Moncon

Moncon is a small CLI program to do automatic monitor dimming based on the sun's position. It is currently only compatible with Windows.

It is installed with go install codeberg.org/rww/moncon/cmd/moncon@latest and then run with moncon.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyStringNotFound = errors.New("key string not found")
View Source
var ErrMissingClosingBrace = errors.New("missing closing brace")
View Source
var ErrMissingFirstBrace = errors.New("missing opening brace")

Functions

func SunPosition

func SunPosition(t time.Time, latitude, longitude float64) (elevationAngle, azimuthAngle float64)

Types

type Code

type Code byte

VCP code

const (
	VCPCodePage                             Code = 0x0  // VCP Code Page
	Degauss                                 Code = 0x1  // Degauss
	NewControlValue                         Code = 0x2  // New Control Value
	SoftControls                            Code = 0x3  // Soft Controls
	RestoreFactoryDefaults                  Code = 0x4  // Restore Factory Defaults
	RestoreFactoryLuminanceContrastDefaults Code = 0x5  // Restore Factory Luminance/ Contrast Defaults
	RestoreFactoryGeometryDefaults          Code = 0x6  // Restore Factory Geometry Defaults
	RestoreFactoryColorDefaults             Code = 0x8  // Restore Factory Color Defaults
	RestoreFactoryTVDefaults                Code = 0xA  // Restore Factory TV Defaults
	ColorTemperatureIncrement               Code = 0xB  // Color Temperature Increment
	ColorTemperatureRequest                 Code = 0xC  // Color Temperature Request
	Clock                                   Code = 0xE  // Clock
	Luminance                               Code = 0x10 // Luminance
	FleshToneEnhancement                    Code = 0x11 // Flesh Tone Enhancement
	Contrast                                Code = 0x12 // Contrast
	BacklightControl                        Code = 0x13 // Backlight Control
	SelectColorPreset                       Code = 0x14 // Select Color Preset
	VideoGainDriveRed                       Code = 0x16 // Video Gain (Drive): Red
	UserColorVisionCompensation             Code = 0x17 // User Color Vision Compensation
	VideoGainDriveGreen                     Code = 0x18 // Video Gain (Drive): Green
	VideoGainDriveBlue                      Code = 0x1A // Video Gain (Drive): Blue
	Focus                                   Code = 0x1C // Focus
	AutoSetup                               Code = 0x1E // Auto Setup
	AutoColorSetup                          Code = 0x1F // Auto Color Setup
	HorizontalPositionPhase                 Code = 0x20 // Horizontal Position (Phase)
	HorizontalSize                          Code = 0x22 // Horizontal Size
	HorizontalPincushion                    Code = 0x24 // Horizontal Pincushion
	HorizontalPincushionBalance             Code = 0x26 // Horizontal Pincushion Balance
	HorizontalConvergenceRB                 Code = 0x28 // Horizontal Convergence R / B
	HorizontalConvergenceMG                 Code = 0x29 // Horizontal Convergence M / G
	HorizontalLinearity                     Code = 0x2A // Horizontal Linearity
	HorizontalLinearityBalance              Code = 0x2C // Horizontal Linearity Balance
	GrayScaleExpansion                      Code = 0x2E // Gray Scale Expansion
	VerticalPositionPhase                   Code = 0x30 // Vertical Position (Phase)
	VerticalSize                            Code = 0x32 // Vertical Size
	VerticalPincushion                      Code = 0x34 // Vertical Pincushion
	VerticalPincushionBalance               Code = 0x36 // Vertical Pincushion Balance
	VerticalConvergenceRB                   Code = 0x38 // Vertical Convergence R/B
	VerticalConvergenceMG                   Code = 0x39 // Vertical Convergence M/G
	VerticalLinearity                       Code = 0x3A // Vertical Linearity
	VerticalLinearityBalance                Code = 0x3C // Vertical Linearity Balance
	ClockPhase                              Code = 0x3E // Clock Phase
	HorizontalParallelogram                 Code = 0x40 // Horizontal Parallelogram
	VerticalParallelogram                   Code = 0x41 // Vertical Parallelogram
	HorizontalKeystone                      Code = 0x42 // Horizontal Keystone
	VerticalKeystone                        Code = 0x43 // Vertical Keystone
	Rotation                                Code = 0x44 // Rotation
	TopCornerFlare                          Code = 0x46 // Top Corner Flare
	TopCornerHook                           Code = 0x48 // Top Corner Hook
	BottomCornerFlare                       Code = 0x4A // Bottom Corner Flare
	BottomCornerHook                        Code = 0x4C // Bottom Corner Hook
	ActiveControl                           Code = 0x52 // Active Control
	PerformancePreservation                 Code = 0x54 // Performance Preservation
	HMoire                                  Code = 0x56 // H Moiré
	VMoire                                  Code = 0x58 // V Moiré
	SixAxisSaturationControlRed             Code = 0x59 // 6 Axis Saturation Control: Red
	SixAxisSaturationControlYellow          Code = 0x5A // 6 Axis Saturation Control: Yellow
	SixAxisSaturationControlGreen           Code = 0x5B // 6 Axis Saturation Control: Green
	SixAxisSaturationControlCyan            Code = 0x5C // 6 Axis Saturation Control: Cyan
	SixAxisSaturationControlBlue            Code = 0x5D // 6 Axis Saturation Control: Blue
	SixAxisSaturationControlMagenta         Code = 0x5E // 6 Axis Saturation Control: Magenta
	InputSelect                             Code = 0x60 // Input Select
	AudioSpeakerVolume                      Code = 0x62 // Audio: Speaker Volume
	AudioSpeakerPairSelect                  Code = 0x63 // Audio: Speaker Pair Select
	AudioMicrophoneVolume                   Code = 0x64 // Audio: Microphone Volume
	AudioJackConnectionStatus               Code = 0x65 // Audio: Jack Connection Status
	AmbientLightSensor                      Code = 0x66 // Ambient Light Sensor
	BacklightLevelWhite                     Code = 0x6B // Backlight Level: White
	VideoBlackLevelRed                      Code = 0x6C // Video Black Level: Red
	BacklightLevelRed                       Code = 0x6D // Backlight Level: Red
	VideoBlackLevelGreen                    Code = 0x6E // Video Black Level: Green
	BacklightLevelGreen                     Code = 0x6F // Backlight Level: Green
	VideoBlackLevelBlue                     Code = 0x70 // Video Black Level: Blue
	BacklightLevelBlue                      Code = 0x71 // Backlight Level: Blue
	Gamma                                   Code = 0x72 // Gamma
	LUTSize                                 Code = 0x73 // LUT Size
	SinglePointLUTOperation                 Code = 0x74 // Single Point LUT Operation
	BlockLUTOperation                       Code = 0x75 // Block LUT Operation
	RemoteProcedureCall                     Code = 0x76 // Remote Procedure Call
	DisplayIdentificationDataOperation      Code = 0x78 // Display Identification Data Operation
	AdjustZoom                              Code = 0x7C // Adjust Zoom
	HorizontalMirrorFlip                    Code = 0x82 // Horizontal Mirror (Flip)
	VerticalMirrorFlip                      Code = 0x84 // Vertical Mirror (Flip)
	DisplayScaling                          Code = 0x86 // Display Scaling
	Sharpness                               Code = 0x87 // Sharpness
	VelocityScanModulation                  Code = 0x88 // Velocity Scan Modulation
	ColorSaturation                         Code = 0x8A // Color Saturation
	TVChannelUpDown                         Code = 0x8B // TV Channel Up / Down
	TVSharpness                             Code = 0x8C // TV Sharpness
	AudioMuteScreenBlank                    Code = 0x8D // Audio Mute / Screen Blank
	TVContrast                              Code = 0x8E // TV Contrast
	AudioTreble                             Code = 0x8F // Audio Treble
	Hue                                     Code = 0x90 // Hue
	AudioBass                               Code = 0x91 // Audio Bass
	TVBlackLevelLuminance                   Code = 0x92 // TV Black Level / Luminance
	AudioBalanceLR                          Code = 0x93 // Audio Balance L / R
	AudioProcessorMode                      Code = 0x94 // Audio Processor Mode:
	WindowPositionTL_X                      Code = 0x95 // Window Position (TL_X)
	WindowPositionTL_Y                      Code = 0x96 // Window Position (TL_Y)
	WindowPositionBR_X                      Code = 0x97 // Window Position (BR_X)
	WindowPositionBR_Y                      Code = 0x98 // Window Position (BR_X)
	WindowBackground                        Code = 0x9A // Window Background
	SixAxisColorControlRed                  Code = 0x9B // 6 Axis Color Control: Red
	SixAxisColorControlYellow               Code = 0x9C // 6 Axis Color Control: Yellow
	SixAxisColorControlGreen                Code = 0x9D // 6 Axis Color Control: Green
	SixAxisColorControlCyan                 Code = 0x9E // 6 Axis Color Control: Cyan
	SixAxisColorControlBlue                 Code = 0x9F // 6 Axis Color Control: Blue
	SixAxisColorControlMagenta              Code = 0xA0 // 6 Axis Color Control: Magenta
	AutoSetupOnOff                          Code = 0xA2 // Auto Setup On / Off
	WindowMaskControl                       Code = 0xA4 // Window Mask Control
	WindowSelect                            Code = 0xA5 // Window Select
	WindowSize                              Code = 0xA6 // Window Size
	WindowTransparency                      Code = 0xA7 // Window Transparency
	ScreenOrientation                       Code = 0xAA // Screen Orientation
	HorizontalFrequency                     Code = 0xAC // Horizontal Frequency
	VerticalFrequency                       Code = 0xAE // Vertical Frequency
	Settings                                Code = 0xB0 // Settings
	FlatPanelSubPixelLayout                 Code = 0xB2 // Flat Panel Sub-Pixel Layout
	SourceTimingMode                        Code = 0xB4 // Source Timing Mode
	SourceColorCoding                       Code = 0xB5 // Source Color Coding
	DisplayTechnologyType                   Code = 0xB6 // Display Technology Type
	DPVLDisplaystatus                       Code = 0xB7 // DPVL : Display status
	DPVLPacketcount                         Code = 0xB8 // DPVL : Packet count
	DPVLDisplayXorigin                      Code = 0xB9 // DPVL : Display X origin
	DPVLDisplayYorigin                      Code = 0xBA // DPVL : Display Y origin
	DPVLHeaderCRCerrorcount                 Code = 0xBB // DPVL : Header CRC error count
	DPVLBodyCRCerrorcount                   Code = 0xBC // DPVL : Body CRC error count
	DPVLClientID                            Code = 0xBD // DPVL : Client ID
	DPVLLinkcontrol                         Code = 0xBE // DPVL : Link control
	DisplayUsageTime                        Code = 0xC0 // Display Usage Time
	DisplayDescriptorLength                 Code = 0xC2 // Display Descriptor Length
	TransmitDisplayDescriptor               Code = 0xC3 // Transmit Display Descriptor
	EnableDisplayofDisplayDescriptor        Code = 0xC4 // Enable Display of ‘Display Descriptor’
	ApplicationEnableKey                    Code = 0xC6 // Application Enable Key
	DisplayControllerID                     Code = 0xC8 // Display Controller ID
	DisplayFirmwareLevel                    Code = 0xC9 // Display Firmware Level
	OSD                                     Code = 0xCA // OSD
	OSDLanguage                             Code = 0xCC // OSD Language
	StatusIndicators                        Code = 0xCD // Status Indicators
	AuxiliaryDisplaySize                    Code = 0xCE // Auxiliary Display Size
	AuxiliaryDisplayData                    Code = 0xCF // Auxiliary Display Data
	OutputSelection                         Code = 0xD0 // Output Selection
	AssetTag                                Code = 0xD2 // Asset Tag
	StereoVideoMode                         Code = 0xD4 // Stereo Video Mode
	PowerMode                               Code = 0xD6 // Power Mode
	AuxiliaryPowerOutput                    Code = 0xD7 // Auxiliary Power Output
	ScanMode                                Code = 0xDA // Scan Mode
	ImageMode                               Code = 0xDB // Image Mode
	DisplayApplication                      Code = 0xDC // Display Application
	ScratchPad                              Code = 0xDE // Scratch Pad
	VCPVersion                              Code = 0xDF // VCP Version
	ManufacturerSpecificE0                  Code = 0xE0 // Manufacturer Specific E0
	ManufacturerSpecificE1                  Code = 0xE1 // Manufacturer Specific E1
	ManufacturerSpecificE2                  Code = 0xE2 // Manufacturer Specific E2
	ManufacturerSpecificE3                  Code = 0xE3 // Manufacturer Specific E3
	ManufacturerSpecificE4                  Code = 0xE4 // Manufacturer Specific E4
	ManufacturerSpecificE5                  Code = 0xE5 // Manufacturer Specific E5
	ManufacturerSpecificE6                  Code = 0xE6 // Manufacturer Specific E6
	ManufacturerSpecificE7                  Code = 0xE7 // Manufacturer Specific E7
	ManufacturerSpecificE8                  Code = 0xE8 // Manufacturer Specific E8
	ManufacturerSpecificE9                  Code = 0xE9 // Manufacturer Specific E9
	ManufacturerSpecificEA                  Code = 0xEA // Manufacturer Specific EA
	ManufacturerSpecificEB                  Code = 0xEB // Manufacturer Specific EB
	ManufacturerSpecificEC                  Code = 0xEC // Manufacturer Specific EC
	ManufacturerSpecificED                  Code = 0xED // Manufacturer Specific ED
	ManufacturerSpecificEE                  Code = 0xEE // Manufacturer Specific EE
	ManufacturerSpecificEF                  Code = 0xEF // Manufacturer Specific EF
	ManufacturerSpecificF0                  Code = 0xF0 // Manufacturer Specific F0
	ManufacturerSpecificF1                  Code = 0xF1 // Manufacturer Specific F1
	ManufacturerSpecificF2                  Code = 0xF2 // Manufacturer Specific F2
	ManufacturerSpecificF3                  Code = 0xF3 // Manufacturer Specific F3
	ManufacturerSpecificF4                  Code = 0xF4 // Manufacturer Specific F4
	ManufacturerSpecificF5                  Code = 0xF5 // Manufacturer Specific F5
	ManufacturerSpecificF6                  Code = 0xF6 // Manufacturer Specific F6
	ManufacturerSpecificF7                  Code = 0xF7 // Manufacturer Specific F7
	ManufacturerSpecificF8                  Code = 0xF8 // Manufacturer Specific F8
	ManufacturerSpecificF9                  Code = 0xF9 // Manufacturer Specific F9
	ManufacturerSpecificFA                  Code = 0xFA // Manufacturer Specific FA
	ManufacturerSpecificFB                  Code = 0xFB // Manufacturer Specific FB
	ManufacturerSpecificFC                  Code = 0xFC // Manufacturer Specific FC
	ManufacturerSpecificFD                  Code = 0xFD // Manufacturer Specific FD
	ManufacturerSpecificFE                  Code = 0xFE // Manufacturer Specific FE
	ManufacturerSpecificFF                  Code = 0xFF // Manufacturer Specific FF
)

func (Code) String

func (i Code) String() string

type CodeInfo

type CodeInfo struct {
	UseDiscrete    bool
	DiscreteValues []uint32
}

func (CodeInfo) String

func (ci CodeInfo) String() string

String returns a string representing a CodeInfo structure.

type VCP

type VCP interface {
	// Info returns the monitor's capability info, parsed from its capability string.
	Info() *VCPInfo

	// Feature queries a monitor for a code's current and max values.
	Feature(code Code) (value, maximum uint32, err error)

	// SetFeature sets a monitor's code to a value.
	SetFeature(code Code, value uint32) error

	// Close tidies up after a monitor is no longer needed.
	Close() error
}

type VCPInfo

type VCPInfo struct {
	ProtocolClass     string
	Type              string
	Commands          []Code
	Codes             map[Code]CodeInfo
	Model             string
	MCCSVer           string
	Windows           map[string]string
	Renames           map[Code]string
	NonStandardFields map[string]string
}

func (*VCPInfo) String

func (vi *VCPInfo) String() string

String returns a string representing a VCPInfo structure.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL