A simple vibe-coded bash script to control external monitor brightness using DDC/CI commands in Hyprland. Adjusts brightness only on the currently focused monitor.
- Control brightness of the monitor where your cursor is currently located
- Increase or decrease brightness by specified percentage (default 20%)
Arch Linux:
sudo pacman -S ddcutilThe i2c-dev kernel module is required for DDC communication:
# Load the module temporarily
sudo modprobe i2c-dev
# Make it permanent by adding to modules-load
echo "i2c-dev" | sudo tee /etc/modules-load.d/i2c-dev.confAdd your user to the i2c group to avoid needing sudo:
sudo usermod -a -G i2c $USERNote: You'll need to log out and back in for group changes to take effect.
Arch Linux:
sudo pacman -S jq-
Download the script:
curl -o ~/.local/bin/bright https://raw.githubusercontent.com/nasht/bright/main/bright chmod +x ~/.local/bin/bright
-
Configure monitor mapping:
First, identify your monitors:
# Get Hyprland monitor names hyprctl monitors # Get ddcutil display numbers ddcutil detect
Then edit the script and update the
get_active_display()function's case statement to match your setup:case "$active_monitor" in "DP-1") echo 1 ;; # Your first monitor "HDMI-A-1") echo 2 ;; # Your second monitor *) echo 1 ;; # Default fallback esac
# Increase brightness by 20% (default)
bright +
# Decrease brightness by 20%
bright -
# Increase brightness by 10%
bright + 10
# Decrease brightness by 5%
bright - 5Add these keybindings to your ~/.config/hypr/hyprland.conf:
# Monitor brightness controls
hyprctl monitors
After adding the keybindings, reload your Hyprland config:
binde = CTRL, F1, exec, ~/bin/bright -
binde = CTRL, F2, exec, ~/bin/bright +-
Check if i2c-dev module is loaded:
lsmod | grep i2c_dev -
Verify i2c devices exist:
ls -la /dev/i2c-* -
Test ddcutil detection:
ddcutil detect
-
Check group membership:
groups $USERShould include
i2cgroup. -
Check device permissions:
ls -la /dev/i2c-* -
If still having issues, try udev rules:
echo 'KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"' | sudo tee /etc/udev/rules.d/45-ddcutil-i2c.rules sudo udevadm control --reload-rules && sudo udevadm trigger
Some monitors don't support DDC/CI or have it disabled:
- Check monitor OSD settings for DDC/CI enable option
- Try different cables (some USB-C to DisplayPort adapters don't support DDC)
- Test with a different VCP code:
ddcutil capabilities
- Verify the monitor mapping in the script matches your setup
- Test ddcutil manually:
ddcutil --display 1 getvcp 10 ddcutil --display 1 setvcp 10 50
Feel free to submit issues and pull requests to improve the script or documentation.
MIT License - feel free to modify and distribute.