### Install and Configure Brightness Sync Agent Source: https://github.com/kfix/ddcctl/wiki/How-to-sync-brightness-of-main-display-with-secondary Installs the ddcctl binary and sets up a launchd agent to sync brightness every minute. Ensure the binary is in your PATH. ```bash mkdir -p ~/Library/LaunchAgents curl -o ~/Library/LaunchAgents/com.zerowidth.launched.sync-brightness.plist http://launched.zerowidth.com/plists/3902c360-bb27-0139-1649-5da0311d64fa.xml launchctl load -w ~/Library/LaunchAgents/com.zerowidth.launched.sync-brightness.plist ``` -------------------------------- ### Download and Install Pre-built Binary Source: https://context7.com/kfix/ddcctl/llms.txt Download the latest release binaries, unzip, and copy the ddcctl executable to your system's PATH. Ensure it has execute permissions. ```bash # Download latest release zip from GitHub curl -L https://github.com/kfix/ddcctl/releases/latest/download/ddcctl_binaries.zip -o ddcctl_binaries.zip unzip ddcctl_binaries.zip cp ddcctl /usr/local/bin/ chmod +x /usr/local/bin/ddcctl ``` -------------------------------- ### Multi-Monitor Preset Script with ddcctl.sh Source: https://context7.com/kfix/ddcctl/llms.txt Example bash script demonstrating control of multiple monitors using named presets, relative adjustments, and persistent state management. ```bash #!/bin/bash # Usage: ddcctl.sh [dim|bright|up|down|volmute|volup|voldown|poweroff] # State is persisted in ~/.ddc_control_state hp="ddcctl -d 1" # HP monitor on display slot 1 len="ddcctl -d 2" # LEN monitor on display slot 2 # Apply dim preset (night-time) dim() { $hp -b 42 -c 26 $len -b 4 -c 9 } # Apply bright preset (daytime) bright() { $hp -b 100 -c 75 $len -b 85 -c 80 } # Increase both monitors by 10 (capped at 100) up() { newb=$((brightness+10)); [[ $newb -gt 100 ]] && newb=100 newc=$((contrast+10)); [[ $newc -gt 100 ]] && newc=100 $hp -b $newb -c $newc $len -b $newb -c $newc } # Automatically select preset based on hour of day (7am–7pm = bright) # Run without arguments for time-based auto-selection ./ddcctl.sh # auto ./ddcctl.sh dim # force dim ./ddcctl.sh bright # force bright ./ddcctl.sh up # step up ./ddcctl.sh volup # raise volume ``` -------------------------------- ### Install ddcctl via Homebrew Source: https://github.com/kfix/ddcctl/blob/main/README.md Use this command to install ddcctl using the Homebrew package manager. Ensure Homebrew is installed on your system. ```bash brew install ddcctl ``` -------------------------------- ### Build ddcctl from Source Source: https://context7.com/kfix/ddcctl/llms.txt Compile ddcctl from its source code. Requires Xcode command-line tools. After building, you can install it to /usr/local/bin. ```bash # Requires Xcode command-line tools git clone https://github.com/kfix/ddcctl.git cd ddcctl make make install # installs to /usr/local/bin ``` -------------------------------- ### Set Monitor Input Source via ddcctl Source: https://github.com/kfix/ddcctl/blob/main/README.md Example of how to set the input source for a specific display. Replace '1' with the desired display number and '17' with the corresponding input source value from the provided table. ```bash ddcctl -d 1 -i 17 ``` -------------------------------- ### Build ddcctl from Source Source: https://github.com/kfix/ddcctl/blob/main/README.md Follow these steps to build ddcctl from its source code. This requires Xcode to be installed on your macOS system. ```bash make ``` -------------------------------- ### Set RGB Color Gain on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Set the Red, Green, and Blue gain values for the first external display. This example sets a warm color profile by boosting red and reducing blue. ```bash # Set a warm color profile (boost red, reduce blue) ddcctl -d 1 -rg 100 -gg 85 -bg 70 ``` -------------------------------- ### Set DDC Reply Timeout with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt Use `-W` to set the minimum reply wait time in nanoseconds. This is useful for slow monitors or specific GPU setups. ```bash # Extend reply timeout to 50ms ddcctl -d 1 -W 50000000 -b ? ``` -------------------------------- ### Display ddcctl Help Options Source: https://github.com/kfix/ddcctl/blob/main/README.md Run this command to view all available options and usage instructions for ddcctl. This is useful for understanding the tool's capabilities. ```bash ddcctl -h ``` -------------------------------- ### Load Launch Agent Source: https://context7.com/kfix/ddcctl/llms.txt Loads a launch agent plist file. Ensure the path to the plist is correct. ```bash launchctl load -w ~/Library/LaunchAgents/com.example.sync-brightness.plist ``` -------------------------------- ### Switch Input Source on Display 2 Source: https://context7.com/kfix/ddcctl/llms.txt Change the active input source for the second external display to USB-C. ```bash # Switch display 2 to USB-C ddcctl -d 2 -i 27 ``` -------------------------------- ### Set Home Preset with ControlPlane Source: https://context7.com/kfix/ddcctl/llms.txt This command sets a medium display preset with a specific input for the 'Home' context in ControlPlane. It uses HDMI input. ```bash ddcctl -d 1 -b 50 -c 40 -i 17 # medium + HDMI ``` -------------------------------- ### Set Office Preset with ControlPlane Source: https://context7.com/kfix/ddcctl/llms.txt This command sets a bright display preset with a specific input for the 'Office' context in ControlPlane. It uses DisplayPort input. ```bash ddcctl -d 1 -b 90 -c 70 -i 15 # bright + DisplayPort ``` -------------------------------- ### Set Brightness and Contrast Together Source: https://context7.com/kfix/ddcctl/llms.txt Multiple settings can be combined in a single invocation, separated by the inter-command delay. ```APIDOC ## Set Brightness and Contrast Together ### Description Multiple settings can be combined in a single invocation, separated by the inter-command delay. ### Usage ```bash # Set both brightness and contrast simultaneously on display 1 ddcctl -d 1 -b 75 -c 50 # "Dim" preset: lower values for night use ddcctl -d 1 -b 30 -c 20 ``` ``` -------------------------------- ### Reset Brightness and Contrast to Factory Defaults Source: https://context7.com/kfix/ddcctl/llms.txt Restore the brightness and contrast settings of the first external display to their factory default values using the VCP reset command. ```bash ddcctl -d 1 -rbc ``` -------------------------------- ### Switch Input Source on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Change the active input source for the first external display. Use the numeric value corresponding to the desired input connector. ```bash # Switch display 1 to HDMI-1 ddcctl -d 1 -i 17 # Switch display 1 to DisplayPort-1 ddcctl -d 1 -i 15 ``` -------------------------------- ### Query Current Input Source on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Query the currently active input source for the first external display. ```bash # Query current input source ddcctl -d 1 -i ? ``` -------------------------------- ### Set Brightness and Contrast Simultaneously Source: https://context7.com/kfix/ddcctl/llms.txt Combine brightness and contrast settings in a single command for display 1. Settings are applied sequentially with the configured inter-command delay. ```bash # Set both brightness and contrast simultaneously on display 1 ddcctl -d 1 -b 75 -c 50 # "Dim" preset: lower values for night use ddcctl -d 1 -b 30 -c 20 ``` -------------------------------- ### Contrast (-c) Source: https://context7.com/kfix/ddcctl/llms.txt Reads or sets the contrast (VCP control 0x12) of the selected display. Syntax is identical to `-b`. ```APIDOC ## Contrast (-c) ### Description Reads or sets the contrast (VCP control `0x12`) of the selected display. Syntax is identical to `-b`. ### Usage ```bash # Query contrast on display 1 ddcctl -d 1 -c ? # Output: I: VCP control #18 (0x12) = current: 70, max: 100 # Set contrast to 60 ddcctl -d 1 -c 60 # Increase contrast by 5 ddcctl -d 1 -c 5+ # Decrease contrast by 10 ddcctl -d 1 -c 10- ``` ``` -------------------------------- ### Step Brightness with Karabiner Source: https://context7.com/kfix/ddcctl/llms.txt These commands are designed to be bound to key events in Karabiner. Use F1 to decrease brightness and F2 to increase it by 5% steps. ```bash ddcctl -d 1 -b 5- # F1 dims ``` ```bash ddcctl -d 1 -b 5+ # F2 brightens ``` -------------------------------- ### Manually Sync Brightness with ddcctl and ioreg Source: https://github.com/kfix/ddcctl/wiki/How-to-sync-brightness-of-main-display-with-secondary Calculates the current brightness percentage of the primary display using ioreg and bc, then applies it to the secondary display using ddcctl. This script is useful for custom configurations or immediate adjustments. ```bash /usr/local/bin/ddcctl -d 1 -b $( ioreg -c AppleBacklightDisplay \ | grep "brightness" \ | sed -nE 's/.*"brightness"={\"min\"=([[:digit:]]+),\"max\"=([[:digit:]]+),\"value\"=([[:digit:]]+)}.*\/scale=10; \3\/\2*100/p' \ | bc\ ) ``` -------------------------------- ### Query Contrast on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Query the current contrast level of the first external display. Similar to brightness, it shows the VCP control, current, and maximum values. ```bash # Query contrast on display 1 ddcctl -d 1 -c ? # Output: I: VCP control #18 (0x12) = current: 70, max: 100 ``` -------------------------------- ### Set Color Presets with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt Use `-preset_a`, `-preset_b`, or `-preset_c` to select specific color temperature or picture presets on your monitor. Values are monitor-specific. ```bash # Dell U2515H: set color preset A to 6500K ddcctl -d 1 -preset_a 5 ``` ```bash # Dell U2515H: set picture mode (preset B) to Movie ddcctl -d 1 -preset_b 3 ``` ```bash # Dell U2515H: query preset_b ddcctl -d 1 -preset_b ? ``` -------------------------------- ### Query Brightness on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Query the current brightness level of the first external display. The output format shows the VCP control, current value, and maximum value. ```bash # Target display 1 ddcctl -d 1 -b ? # Output: I: VCP control #16 (0x10) = current: 75, max: 100 ``` -------------------------------- ### ddcctl Value Setting Grammar Source: https://context7.com/kfix/ddcctl/llms.txt Understand the syntax for setting values, including querying (`?`), absolute values (`NN`), and relative adjustments (`NN+`, `NN-`, `+NN`, `-NN`). ```bash # All equivalent ways to query brightness ddcctl -d 1 -b ? ``` ```bash # All equivalent relative brightness adjustments (+10) ddcctl -d 1 -b 10+ ddcctl -d 1 -b +10 ``` -------------------------------- ### Set Contrast on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Set the contrast of the first external display to an absolute value. Values range from 0 to the maximum supported by the monitor. ```bash # Set contrast to 60 ddcctl -d 1 -c 60 ``` -------------------------------- ### Perform Full Monitor Reset with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt The `-reset` command sends the VCP reset code `0x04` to restore all monitor settings to factory defaults. ```bash ddcctl -d 1 -reset ``` -------------------------------- ### Query RGB Color Gain on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Query the current Red, Green, and Blue gain settings for the first external display. Support varies by monitor firmware. ```bash # Query all three color channels ddcctl -d 1 -rg ? -gg ? -bg ? ``` -------------------------------- ### Dump All VCP Values with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt Use the `-D` flag to iterate through all 256 VCP control codes and display their current and maximum values. This is useful for discovering supported monitor controls. ```bash ddcctl -d 1 -D # Output: iterates 0x00..0xFF, printing each register's current/max value ``` -------------------------------- ### List Detected External Displays Source: https://context7.com/kfix/ddcctl/llms.txt Run ddcctl without any action flags to list detected external displays and display the tool's help information. This helps identify the target display index. ```bash # List detected external displays (no action flags = prints help + display count) ddcctl ``` -------------------------------- ### Adjust Contrast Relatively on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Increase or decrease the contrast of the first external display by a relative amount. Use '+' for increase and '-' for decrease. ```bash # Increase contrast by 5 ddcctl -d 1 -c 5+ # Decrease contrast by 10 ddcctl -d 1 -c 10- ``` -------------------------------- ### Query Monitor Orientation with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt Use the `-o` flag to query the physical rotation of the display. This is a read-only VCP control. ```bash ddcctl -d 1 -o # Output: I: VCP control #170 (0xaa) = current: 1, max: 4 # 1=0°, 2=90°, 3=180°, 4=270° ``` -------------------------------- ### Set Brightness on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Set the brightness of the first external display to an absolute value. Values range from 0 to the maximum supported by the monitor. ```bash # Set brightness to 50 (absolute) ddcctl -d 1 -b 50 ``` -------------------------------- ### Query Speaker Volume on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Query the current volume level of the built-in speaker on the first external display. ```bash # Query current volume ddcctl -d 1 -v ? ``` -------------------------------- ### Reset Brightness and Contrast (-rbc) Source: https://context7.com/kfix/ddcctl/llms.txt Sends VCP reset command 0x05 to restore the monitor's factory default brightness and contrast values. ```APIDOC ## Reset Brightness and Contrast (-rbc) ### Description Sends VCP reset command `0x05` to restore the monitor's factory default brightness and contrast values. ### Usage ```bash ddcctl -d 1 -rbc ``` ``` -------------------------------- ### Sync Secondary Display Brightness to Built-in Display (macOS) Source: https://context7.com/kfix/ddcctl/llms.txt A one-liner script for macOS that reads the built-in display's brightness percentage and applies it to an external display using ddcctl. ```bash # One-liner: read macOS backlight brightness percentage and apply to external display 1 /usr/local/bin/ddcctl -d 1 -b $( ioreg -c AppleBacklightDisplay \ | grep "brightness" \ | sed -nE 's/.*"brightness"=\{\"min\"=([[:digit:]]+),\"max\"=([[:digit:]]+),\"value\"=([[:digit:]]+)\}.*/scale=10; \3/\2*100/p' \ | bc ) ``` -------------------------------- ### Adjust Brightness Relatively on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Increase or decrease the brightness of the first external display by a relative amount. Use '+' for increase and '-' for decrease. ```bash # Increase brightness by 10 ddcctl -d 1 -b 10+ # Decrease brightness by 20 ddcctl -d 1 -b 20- ``` -------------------------------- ### Reset Color Calibration on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Restore the color calibration settings (RGB gain) of the first external display to their factory default values using the VCP reset command. ```bash ddcctl -d 1 -rrgb ``` -------------------------------- ### Check On-Screen Display Status with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt The `-osd` flag queries whether the monitor's OSD menu is currently open. Returns `1` for closed and `2` for active. ```bash ddcctl -d 1 -osd # Output: I: VCP control #202 (0xca) = current: 1, max: 2 ``` -------------------------------- ### Adjust Blue Gain Relatively on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Decrease the Blue gain setting for the first external display by a relative amount. ```bash # Reduce blue gain by 10 ddcctl -d 1 -bg 10- ``` -------------------------------- ### Brightness (-b) Source: https://context7.com/kfix/ddcctl/llms.txt Reads or sets the brightness (VCP control 0x10) of the selected display. Accepts an absolute value, a relative increment/decrement, or `?` to query the current value. ```APIDOC ## Brightness (-b) ### Description Reads or sets the brightness (VCP control `0x10`) of the selected display. Accepts an absolute value, a relative increment/decrement, or `?` to query the current value. ### Usage ```bash # Query current brightness on display 1 ddcctl -d 1 -b ? # Output: I: VCP control #16 (0x10) = current: 75, max: 100 # Set brightness to 50 (absolute) ddcctl -d 1 -b 50 # Increase brightness by 10 ddcctl -d 1 -b 10+ # Decrease brightness by 20 ddcctl -d 1 -b 20- ``` ``` -------------------------------- ### Select Display (-d) Source: https://context7.com/kfix/ddcctl/llms.txt Selects the target external display by its 1-based index. Display 1 is the first external monitor detected by macOS. The built-in MacBook display is always skipped. ```APIDOC ## Select Display (-d) ### Description Selects the target external display by 1-based index. Display `1` is the first external monitor detected by macOS. The built-in MacBook display is always skipped. ### Usage ```bash # List detected external displays (no action flags = prints help + display count) ddcctl # Target display 1 ddcctl -d 1 -b ? # Target display 2 ddcctl -d 2 -b ? ``` ``` -------------------------------- ### Input Source (-i) Source: https://context7.com/kfix/ddcctl/llms.txt Switches the active input source (VCP control 0x60). The numeric value corresponds to the physical connector type per the MCCS standard. ```APIDOC ## Input Source (-i) ### Description Switches the active input source (VCP control `0x60`). The numeric value corresponds to the physical connector type per the MCCS standard. ### Input Mapping | Input | Value | Input | Value | |-------|-------|-------|-------| | VGA-1 | 1 | DisplayPort-1 | 15 | | DVI-1 | 3 | DisplayPort-2 | 16 | | DVI-2 | 4 | HDMI-1 | 17 | | Component 1 | 12 | HDMI-2 | 18 | | | | USB-C | 27 | ### Usage ```bash # Switch display 1 to HDMI-1 ddcctl -d 1 -i 17 # Switch display 1 to DisplayPort-1 ddcctl -d 1 -i 15 # Switch display 2 to USB-C ddcctl -d 2 -i 27 # Query current input source ddcctl -d 1 -i ? ``` ``` -------------------------------- ### RGB Gain (-rg, -gg, -bg) Source: https://context7.com/kfix/ddcctl/llms.txt Adjusts individual red (VCP 0x16), green (VCP 0x18), and blue (VCP 0x1A) gain channels. Support varies by monitor firmware. ```APIDOC ## RGB Gain (-rg, -gg, -bg) ### Description Adjusts individual red (VCP `0x16`), green (VCP `0x18`), and blue (VCP `0x1A`) gain channels. Support varies by monitor firmware. ### Usage ```bash # Query all three color channels ddcctl -d 1 -rg ? -gg ? -bg ? # Set a warm color profile (boost red, reduce blue) ddcctl -d 1 -rg 100 -gg 85 -bg 70 # Reduce blue gain by 10 ddcctl -d 1 -bg 10- ``` ``` -------------------------------- ### Reset Color (-rrgb) Source: https://context7.com/kfix/ddcctl/llms.txt Sends VCP reset command 0x08 to restore the monitor's factory color calibration. ```APIDOC ## Reset Color (-rrgb) ### Description Sends VCP reset command `0x08` to restore the monitor's factory color calibration. ### Usage ```bash ddcctl -d 1 -rrgb ``` ``` -------------------------------- ### Set Speaker Volume on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Set the volume of the built-in speaker on the first external display. Values range from 1 to 254. Monitor firmware must support this feature. ```bash # Set volume to 20 ddcctl -d 1 -v 20 ``` -------------------------------- ### Adjust Speaker Volume Relatively on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Increase or decrease the speaker volume on the first external display by a relative amount. ```bash # Increase volume by 5 ddcctl -d 1 -v 5+ ``` -------------------------------- ### Toggle Brightness Preset with Alfred Source: https://context7.com/kfix/ddcctl/llms.txt This script checks the current brightness and toggles between a dim and bright preset using ddcctl. It's suitable for use in an Alfred workflow's shell action. ```bash if ddcctl -d 1 -b ? 2>&1 | grep -q "current: [0-9][0-9]$"; then ddcctl -d 1 -b 30 -c 20 # dim else ddcctl -d 1 -b 100 -c 75 # bright fi ``` -------------------------------- ### Speaker Volume (-v) Source: https://context7.com/kfix/ddcctl/llms.txt Sets the built-in speaker volume (VCP control 0x62). Accepts values 1–254. Support depends on monitor firmware. ```APIDOC ## Speaker Volume (-v) ### Description Sets the built-in speaker volume (VCP control `0x62`). Accepts values 1–254. Support depends on monitor firmware. ### Usage ```bash # Set volume to 20 ddcctl -d 1 -v 20 # Query current volume ddcctl -d 1 -v ? # Increase volume by 5 ddcctl -d 1 -v 5+ ``` ``` -------------------------------- ### Set Inter-Command Delay with ddcctl Source: https://context7.com/kfix/ddcctl/llms.txt The `-w` flag sets the delay in microseconds between DDC commands. Reduce for faster operations or increase if a monitor misses commands. ```bash # Apply brightness and contrast with a 200ms inter-command delay ddcctl -d 1 -w 200000 -b 80 -c 60 ``` -------------------------------- ### VCP Control Code Reference (DDC.h) Source: https://context7.com/kfix/ddcctl/llms.txt A reference of key VCP control codes used internally by ddcctl and available for raw testing. These codes correspond to various monitor settings. ```c #define RESET 0x04 #define RESET_BRIGHTNESS_AND_CONTRAST 0x05 #define RESET_COLOR 0x08 #define BRIGHTNESS 0x10 #define CONTRAST 0x12 #define COLOR_PRESET_A 0x14 #define RED_GAIN 0x16 #define GREEN_GAIN 0x18 #define BLUE_GAIN 0x1A #define INPUT_SOURCE 0x60 #define AUDIO_SPEAKER_VOLUME 0x62 #define AUDIO_MUTE 0x8D #define ORIENTATION 0xAA #define ON_SCREEN_DISPLAY 0xCA // read-only #define OSD_LANGUAGE 0xCC #define COLOR_PRESET_B 0xDC #define COLOR_PRESET_C 0xE0 ``` -------------------------------- ### Mute Speaker on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Mute the built-in speaker on the first external display by setting the audio mute VCP control to ON (value 2). ```bash # Mute speaker ddcctl -d 1 -m 2 ``` -------------------------------- ### Audio Mute (-m) Source: https://context7.com/kfix/ddcctl/llms.txt Mutes or unmutes the monitor's built-in speaker (VCP control 0x8D). Value 1 = OFF (unmute), 2 = ON (mute). ```APIDOC ## Audio Mute (-m) ### Description Mutes or unmutes the monitor's built-in speaker (VCP control `0x8D`). Value `1` = OFF (unmute), `2` = ON (mute). ### Usage ```bash # Mute speaker ddcctl -d 1 -m 2 # Unmute speaker ddcctl -d 1 -m 1 ``` ``` -------------------------------- ### Unmute Speaker on Display 1 Source: https://context7.com/kfix/ddcctl/llms.txt Unmute the built-in speaker on the first external display by setting the audio mute VCP control to OFF (value 1). ```bash # Unmute speaker ddcctl -d 1 -m 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.