Skip to content

philling-dev/monitor-brightness-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–ฅ๏ธ Monitor Brightness Control

License Platform Python DDC/CI

A user-friendly controller for adjusting brightness, contrast, and input source of external monitors via DDC/CI on Linux

๐Ÿ“ฅ Installation โ€ข ๐Ÿ“š Usage โ€ข โš™๏ธ Configuration โ€ข ๐Ÿค Contributing


โœจ Features

๐ŸŽ›๏ธ Multiple Interfaces

  • Command-line interface with intuitive commands
  • Modern GUI with real-time sliders and system tray integration
  • Background service for global hotkeys and automation

๐Ÿ“‹ Profile Management

  • Pre-configured profiles: Day (bright), Night (dim), Gaming (max brightness)
  • Custom profile creation from current monitor settings
  • Automatic profile application on system startup

โŒจ๏ธ Global Hotkeys

  • Ctrl + Alt + 1/2/3: Switch between profiles instantly
  • Ctrl + Alt + โ†‘/โ†“: Quick brightness adjustment (+/-10%)
  • Fully customizable key combinations

๐Ÿ–ฅ๏ธ Multi-Monitor Support

  • Automatic detection of DDC/CI compatible monitors
  • Individual control per monitor via bus addressing
  • Batch operations across all connected displays

๐Ÿš€ Quick Presets

  • One-click presets in GUI: Day, Night, Gaming modes
  • Percentage-based controls (0-100%) for easy adjustment
  • Real-time feedback and error handling

๐Ÿ“‹ Prerequisites

System Dependencies

Ubuntu/Debian:

sudo apt update
sudo apt install ddcutil i2c-tools

Arch Linux:

sudo pacman -S ddcutil

Fedora:

sudo dnf install ddcutil

Hardware Requirements

  • Monitor with DDC/CI support (most modern displays)
  • DisplayPort or HDMI connection (recommended)
  • I2C communication capability

Permission Setup

# Add user to i2c group
sudo usermod -a -G i2c $USER

# Load i2c-dev module
sudo modprobe i2c-dev
echo 'i2c-dev' | sudo tee /etc/modules-load.d/i2c.conf

# Reboot or re-login to apply changes

๐Ÿš€ Installation

Option 1: Automated Installation (Recommended)

# Clone and run the installation script
git clone https://github.com/philling-dev/monitor-brightness-control.git
cd monitor-brightness-control
chmod +x install.sh
./install.sh

The script automatically:

  • โœ… Installs system dependencies
  • โœ… Sets up I2C permissions and udev rules
  • โœ… Installs the Python package
  • โœ… Creates desktop entries
  • โœ… Configures systemd service (optional)

Option 2: Manual Installation

# Install via pip
pip install monitor-brightness-control

# Or install from source
git clone https://github.com/philling-dev/monitor-brightness-control.git
cd monitor-brightness-control
pip install -e .

๐Ÿ“– Usage

Command Line Interface

Monitor Detection:

# Detect available monitors
monitor-control detect

# Show detailed monitor information
monitor-control info

Brightness Control:

# Get current brightness
monitor-control brightness

# Set brightness to 80%
monitor-control brightness --value 80

# Control specific monitor (use bus number from detect)
monitor-control brightness --bus 4 --value 60

Contrast Control:

# Get current contrast
monitor-control contrast

# Set contrast to 75%
monitor-control contrast --value 75

Graphical Interface

Launch GUI:

monitor-gui

GUI Features:

  • ๐ŸŽ›๏ธ Real-time brightness and contrast sliders
  • ๐ŸŽฏ Quick preset buttons (Day/Night/Gaming)
  • ๐Ÿ”” System tray integration with minimize-to-tray
  • ๐Ÿ”„ Automatic monitor detection and refresh
  • โšก Instant feedback and error notifications

Background Service & Hotkeys

Start Background Service:

# Start service manually
python -m monitor_control.service start

# Check service status
python -m monitor_control.service status

Default Hotkeys:

Combination Action
Ctrl + Alt + 1 Apply Day profile (80% brightness)
Ctrl + Alt + 2 Apply Night profile (20% brightness)
Ctrl + Alt + 3 Apply Gaming profile (100% brightness)
Ctrl + Alt + โ†‘ Increase brightness (+10%)
Ctrl + Alt + โ†“ Decrease brightness (-10%)

โš™๏ธ Configuration

Configuration files are stored in ~/.config/monitor-control/:

settings.json

{
  "auto_apply_on_startup": true,
  "default_profile": "day",
  "hotkeys_enabled": true,
  "hotkeys": {
    "day_profile": ["ctrl", "alt", "1"],
    "night_profile": ["ctrl", "alt", "2"],
    "gaming_profile": ["ctrl", "alt", "3"],
    "brightness_up": ["ctrl", "alt", "up"],
    "brightness_down": ["ctrl", "alt", "down"]
  }
}

profiles.json

Contains saved profiles with brightness and contrast settings for each monitor. Profiles are automatically created and can be customized through the GUI or CLI.


๐Ÿ–ฅ๏ธ Compatibility

Supported Hardware

Connection Type Compatibility Notes
โœ… DisplayPort Full Support Recommended for best compatibility
โœ… HDMI Full Support Modern displays work well
โš ๏ธ DVI-D Limited Support Digital DVI may work
โŒ VGA Not Supported Analog connections don't support DDC/CI

Tested Distributions

  • โœ… Ubuntu 20.04+ / Linux Mint 20+
  • โœ… Debian 11+
  • โœ… Fedora 35+
  • โœ… Arch Linux / Manjaro
  • โœ… openSUSE Leap/Tumbleweed
  • ๐Ÿงช Other distributions (community tested)

๐Ÿ”ง Troubleshooting

"ddcutil not found"

# Install ddcutil package
sudo apt install ddcutil  # Ubuntu/Debian
sudo pacman -S ddcutil     # Arch Linux
sudo dnf install ddcutil   # Fedora

"No monitors detected"

# Test ddcutil directly
ddcutil detect

# Check I2C permissions
ls -la /dev/i2c-*
groups $USER  # Should include 'i2c'

# Reload I2C module
sudo modprobe -r i2c_dev && sudo modprobe i2c_dev

"Permission denied"

# Add user to i2c group and reboot
sudo usermod -a -G i2c $USER
sudo reboot

Monitor Not Responding

  • โœ… Enable DDC/CI in monitor's OSD menu
  • โœ… Switch monitor to "PC" mode (not "Console" mode)
  • โœ… Try DisplayPort cable instead of HDMI/DVI
  • โœ… Update monitor firmware if available

๐Ÿš€ System Integration

Autostart Service (systemd)

# Enable user service
systemctl --user enable monitor-control.service
systemctl --user start monitor-control.service

# Check status
systemctl --user status monitor-control.service

Desktop Entry

A desktop entry is automatically created at: ~/.local/share/applications/monitor-control.desktop

This adds "Monitor Control" to your application menu.


๐Ÿ—๏ธ Project Architecture

src/monitor_control/
โ”œโ”€โ”€ __init__.py          # Package initialization
โ”œโ”€โ”€ ddc.py              # DDC/CI interface with ddcutil
โ”œโ”€โ”€ cli.py              # Command-line interface
โ”œโ”€โ”€ gui.py              # PyQt6 graphical interface
โ”œโ”€โ”€ profiles.py         # Profile management and hotkeys
โ””โ”€โ”€ service.py          # Background service

Core Components

  • DDCController: Low-level ddcutil wrapper with error handling
  • ProfileManager: Saves/loads monitor configurations and settings
  • HotkeyManager: Global keyboard shortcut handling
  • MonitorControlService: Background daemon for automation

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒŸ Create a feature branch (git checkout -b feature/amazing-feature)
  3. ๐Ÿ’ป Commit your changes (git commit -m 'Add amazing feature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-feature)
  5. ๐Ÿ”„ Open a Pull Request

Development Setup

git clone https://github.com/philling-dev/monitor-brightness-control.git
cd monitor-brightness-control
python -m venv venv
source venv/bin/activate
pip install -e .
pytest  # Run tests

๐Ÿ’– Support the Project

If this project was helpful to you, please consider supporting its development:

โ˜• Buy me a coffee

๐Ÿช™ Bitcoin

To donate, copy the address below:

1Lyy8GJignLbTUoTkR1HKSe8VTkzAvBMLm

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ’– Acknowledgments

  • ๐Ÿ™ ddcutil - The foundation tool for DDC/CI communication
  • ๐Ÿง The Linux community for making advanced monitor control possible
  • ๐Ÿงช Contributors and testers who help improve compatibility

๐Ÿ”ฎ Roadmap

  • ๐Ÿ”Œ Monitor input source switching
  • ๐Ÿ• Time-based automatic profiles
  • ๐ŸŒ… Ambient light sensor integration
  • ๐ŸŒ Web interface for remote control
  • ๐ŸŽ Limited macOS support exploration
  • ๐Ÿ“ฑ Application-specific profiles
  • ๐Ÿ”— REST API for automation

Star โญ this repository if it helped you!

Report Bug โ€ข Request Feature โ€ข Documentation

About

Professional GUI and CLI tool for controlling external monitor brightness and contrast via DDC/CI on Linux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •