Skip to content
/ bright Public

ddcutil keybindings to control brightness on external screens on omarchy

License

Notifications You must be signed in to change notification settings

nasht/bright

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Hyprland External Monitor Brightness Control

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.

Features

  • Control brightness of the monitor where your cursor is currently located
  • Increase or decrease brightness by specified percentage (default 20%)

Prerequisites

1. Install ddcutil

Arch Linux:

sudo pacman -S ddcutil

2. Load i2c-dev Kernel Module

The 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.conf

3. Set Up Permissions

Add your user to the i2c group to avoid needing sudo:

sudo usermod -a -G i2c $USER

Note: You'll need to log out and back in for group changes to take effect.

4. Install jq (for JSON parsing)

Arch Linux:

sudo pacman -S jq

Installation

  1. Download the script:

    curl -o ~/.local/bin/bright https://raw.githubusercontent.com/nasht/bright/main/bright
    chmod +x ~/.local/bin/bright
  2. 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

Usage

# Increase brightness by 20% (default)
bright +

# Decrease brightness by 20%
bright -

# Increase brightness by 10%
bright + 10

# Decrease brightness by 5%
bright - 5

Hyprland Keybinding Setup

Add 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 +

Troubleshooting

"No displays detected" error

  1. Check if i2c-dev module is loaded:

    lsmod | grep i2c_dev
  2. Verify i2c devices exist:

    ls -la /dev/i2c-*
  3. Test ddcutil detection:

    ddcutil detect

Permission denied errors

  1. Check group membership:

    groups $USER

    Should include i2c group.

  2. Check device permissions:

    ls -la /dev/i2c-*
  3. 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

Monitor not responding

Some monitors don't support DDC/CI or have it disabled:

  1. Check monitor OSD settings for DDC/CI enable option
  2. Try different cables (some USB-C to DisplayPort adapters don't support DDC)
  3. Test with a different VCP code:
    ddcutil capabilities

Script runs but brightness doesn't change

  1. Verify the monitor mapping in the script matches your setup
  2. Test ddcutil manually:
    ddcutil --display 1 getvcp 10
    ddcutil --display 1 setvcp 10 50

Contributing

Feel free to submit issues and pull requests to improve the script or documentation.

License

MIT License - feel free to modify and distribute.

About

ddcutil keybindings to control brightness on external screens on omarchy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages