Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Linux Brightness Control

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.

Features

Version 1: Core Functionality

  • Brightness slider for granular control (10% to 100%).
  • Increment and decrement buttons for quick adjustments.
  • Clean, minimal user interface with glass-morphism effects.

Version 2: Background Operation and Synchronization

  • 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.

Version 3: Keyboard Shortcuts and CLI Support

  • 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.

Technical Details

  • Framework: .NET 10.0
  • UI Library: Avalonia UI
  • Backend: xrandr (X11)
  • Platform: Linux (x64)

Installation

Prerequisites

  • .NET SDK 10.0
  • xrandr

Installation Steps

  1. Clone the repository to your local machine.
  2. Ensure the setup script is executable: chmod +x setup.sh
  3. 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.

Usage

GUI

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.

Keyboard Shortcuts (Version 3)

To map your physical brightness keys (e.g., F7 and F8) to this application:

  1. Open your system's Keyboard Settings.
  2. Navigate to Shortcuts > Custom Shortcuts.
  3. Create a new shortcut:
    • Name: Brightness Increase
    • Command: BrightnessControl --inc
    • Shortcut Key: F8
  4. Create a second shortcut:
    • Name: Brightness Decrease
    • Command: BrightnessControl --dec
    • Shortcut Key: F7

Architecture

The application is split into three main components:

  1. BrightnessService: Handles all process communication with xrandr, including output detection and parsing verbose output for current levels.
  2. MainWindow: The Avalonia-based user interface providing visual controls.
  3. App: Manages the application lifecycle, tray icon logic, and window state.

License

MIT License

About

linux-brightness-fix is a lightweight and modern desktop application built with C# and Avalonia UI to provide granular brightness control for Linux systems. It operates via the xrandr backend, offering a clean graphical interface with a slider and increment/decrement buttons.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages