A lightweight desktop application built with C# and Avalonia for controlling screen brightness on Linux systems using xrandr. This application is designed specifically for Linux environments where hardware brightness keys may not function correctly out of the box.
- Brightness slider for granular control (10% to 100%).
- Increment and decrement buttons for quick adjustments.
- Clean, minimal user interface with glass-morphism effects.
- System Tray Integration: The application can be minimized to the system tray to keep the workspace clean.
- Auto-Detection: Detects current system brightness on startup.
- Active Synchronization: Periodically polls xrandr to ensure the UI stays in sync with external brightness changes.
- Command-Line Arguments: Supports --inc and --dec flags for brightness adjustment.
- Global Hotkeys: Designed to be bound to physical keys (like F7/F8) via system settings.
- Framework: .NET 10.0
- UI Library: Avalonia UI
- Backend: xrandr (X11)
- Platform: Linux (x64)
- .NET SDK 10.0
- xrandr
- Clone the repository to your local machine.
- Ensure the setup script is executable: chmod +x setup.sh
- Run the setup script: ./setup.sh
The setup script will compile the application into a single-file executable, copy it to /usr/local/bin/BrightnessControl, and create a desktop entry in ~/.local/share/applications/ so it appears in your application menu.
Launch the application from your menu and use the slider or buttons to adjust brightness. Closing the window will hide it in the system tray. To exit completely, right-click the tray icon and select Exit.
To map your physical brightness keys (e.g., F7 and F8) to this application:
- Open your system's Keyboard Settings.
- Navigate to Shortcuts > Custom Shortcuts.
- Create a new shortcut:
- Name: Brightness Increase
- Command: BrightnessControl --inc
- Shortcut Key: F8
- Create a second shortcut:
- Name: Brightness Decrease
- Command: BrightnessControl --dec
- Shortcut Key: F7
The application is split into three main components:
- BrightnessService: Handles all process communication with xrandr, including output detection and parsing verbose output for current levels.
- MainWindow: The Avalonia-based user interface providing visual controls.
- App: Manages the application lifecycle, tray icon logic, and window state.
MIT License