Skip to content

fxjung/backlight_utility

Repository files navigation

Backlight Utility

Screen brightness control utility for at least Thinkpad T490

This is Free software under the MIT license.

Features

Installation

Prerequisites

  • Linux
  • notify-send and a notification daemon
  • Python 3.10

Setup

git clone [email protected]:fxjung/backlight_utility.git
cd backlight_utility
pip install -e .[dev]
pre-commit install

Then create a .env file containing the paths to the respective files:

BRIGHTNESS_PATH=/sys/class/backlight/intel_backlight/brightness
MAX_BRIGHTNESS_PATH=/sys/class/backlight/intel_backlight/max_brightness
ACTUAL_BRIGHTNESS_PATH=/sys/class/backlight/intel_backlight/actual_brightness

Keep in mind that the brightness path needs to be writable by the user running this software. This can e.g. be achieved by means of a udev rule (/etc/udev/rules.d/99-backlight.rules):

ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness", RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness" 

Apparently, directly using udev's MODE and GROUP doesn't work here for some reason. The above does.

Usage

This can e.g. be used to control the screen brightness via i3wm keyboard shortcuts by modifying ~/.i3/config:

bindsym XF86MonBrightnessDown exec --no-startup-id "backlight_utility set --relative --notification relative -- -10"
bindsym XF86MonBrightnessUp exec --no-startup-id "backlight_utility set --relative --notification relative -- 10"

The CLI interface offers the following commands:

backlight_utility get
backlight_utility set

to set and retrieve the current brightness. Help is available accordingly:

backlight_utility get --help
backlight_utility set --help

Examples

backlight_utility get
backlight_utility set -- -50
backlight_utility set --absolute --value --notification absolute 1000

About

backlight_utility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages