https://github.com/getbettr/loglux
Logarithmic brightness control for Linux. 🦀🐧
https://github.com/getbettr/loglux
brightness-control linux musl-libc rust sysfs
Last synced: 5 months ago
JSON representation
Logarithmic brightness control for Linux. 🦀🐧
- Host: GitHub
- URL: https://github.com/getbettr/loglux
- Owner: getbettr
- License: unlicense
- Created: 2024-09-28T10:59:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-21T02:07:39.000Z (6 months ago)
- Last Synced: 2025-12-22T23:13:21.275Z (6 months ago)
- Topics: brightness-control, linux, musl-libc, rust, sysfs
- Language: Rust
- Homepage: https://getbetter.ro/projects/#loglux
- Size: 90.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Loglux
======
[](https://github.com/rarescosma/loglux/blob/master/UNLICENSE)
Loglux is a simple rust application with portable binaries to control brightness.
While heavily inspired by the original [lux][lux], it differs from it in one major aspect:
The brightness control is [logarithmic][weber-fechner] - as we approach darker and
darker brightness values the control step gets smaller and smaller.
It's perfect for us creatures of the night watching rust streams in complete
darkness at 1AM as it allows us to make the laptop screen *really* dark.
## Usage
```
loglux OPERATION [-p|--path (default: /sys/class/backlight)] [-n|--num-steps (default: 75)] [--no-notify]
```
* `OPERATION` is either `up` or `down`
* `--path` can be either a start directory containing multiple controllers, or a path to specific
controller.
In the directory case, the controller with the highest `max_brightness` setting will be selected.
* `--num-steps` is the only tunable parameter and it specifies the total number of steps for the
adjustment scale. The default is tuned for steps of 9-10% near the maximum, then they'll get
smaller and smaller as we approach the minimum.
* `--no-notify` skips the notification of the new value via `notify-send`.
## Installation
Binaries for Linux on various architectures are available on the [releases][releases] page.
They are statically linked against [musl][musl] to completely reduce runtime dependencies.
> [!NOTE]
> Your user _must_ have write rights for the `/sys/class/backlight/.../brightness`
> file you're planning to use.
>
> Your best bet is to do a `ls -a /sys/class/backlight/*/brightness` and check if
> it's owned by the `video` group and if the group has write rights.
>
> If that's the case, simply add your user to the `video` group: `sudo usermod -aG video $USER`
>
> For a more involved solution using `udev` you could first add your user to the `wheel` group:
>
> ```
> sudo usermod -aG wheel $USER
> ```
>
> Then define the udev rules to ensure the brightness file is writeable:
>
> ```
> sudo tee /etc/udev/rules.d/99-loglux.rules < RUN+="/bin/chgrp wheel /sys/class/backlight/intel_backlight/brightness"
> RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
> EOF
> ```
>
> Finally, trigger udev:
>
> ```
> sudo udevadm control --reload-rules && sudo udevadm trigger
> ```
[lux]: https://github.com/Ventto/lux
[weber-fechner]: https://en.wikipedia.org/wiki/Weber%E2%80%93Fechner_law
[releases]: https://github.com/rarescosma/loglux/releases
[musl]: https://musl.libc.org/