This repository contains a Go program that adjusts the brightness of the backlight on your system.
- Go installed on your machine (Go Installation Guide)
- Linux system with sysfs support for backlight control
git clone https://github.com/shamspathan/britelin.git
cd britelin
Compile the program using go build
:
go build -p=2 -ldflags="-s -w" -gcflags="all=-N -l" britelin.go
Run the program with the value you want to add or subtract from the current brightness:
sudo ./britelin <value_to_add>
- Replace
<value_to_add>
with the numeric value by which you want to adjust the brightness. - Use a positive value to increase brightness and a negative value to decrease brightness.
Example:
# Increase brightness by 10
sudo ./britelin 10
# Decrease brightness by 5
sudo ./britelin -5
- Ensure the program is executed with appropriate permissions to write to the backlight file (
/sys/class/backlight/intel_backlight/brightness
). You might need to usesudo
or adjust permissions accordingly.
Ensure you have already built the britelin
program as described in the previous sections. If not, follow these steps:
git clone https://github.com/shamspathan/britelin.git
cd britelin
go build -p=2 -ldflags="-s -w" -gcflags="all=-N -l" britelin.go
sudo mv britelin /usr/local/bin
-
Open the i3wm configuration file (
~/.config/i3/config
) in a text editor. -
Add the following lines to the configuration file:
bindsym XF86MonBrightnessDown exec britelin -10
bindsym XF86MonBrightnessUp exec britelin 10
These lines bind the XF86MonBrightnessDown
and XF86MonBrightnessUp
keys (typically used for brightness adjustment on keyboards) to execute the britelin
program with the specified brightness adjustments (-10
for decrease, 10
for increase).
Save the changes to the i3wm configuration file and reload i3wm to apply the changes:
Press Mod+Shift+R
to reload the i3wm configuration.
After integrating britelin
with i3wm, you can now use the designated brightness adjustment keys (usually the function keys related to brightness on your keyboard) to adjust the brightness level within the i3wm environment.
For example:
- Press
XF86MonBrightnessDown
to decrease brightness. - Press
XF86MonBrightnessUp
to increase brightness.
- Ensure the
britelin
program is in the system's path (/usr/local/bin
) for i3wm to execute it correctly. - Adjust the
-10
and10
values in the i3wm configuration to change the brightness adjustment step size according to your preference.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.