Keyboard backlight control and notifications. Written for use with i3wm, but works with any window manager or as a standalone script.
notify-osd | dunst |
---|---|
xosd | herbe |
---|---|
- awk (POSIX compatible)
- bc
- upower
Manual setup for i3wm
Clone this repository:
git clone https://github.com/hastinbe/i3-kb-backlight.git ~/i3-kb-backlight
Edit the following example and append it to your ~/.config/i3/config:
## Keyboard backlight control
# Path to backlight script
set $backlight_path ~/i3-kb-backlight
# Amount to increase/decrease brightness
set $brightness_step 1
bindsym XF86KbdBrightnessUp exec $backlight_path/brightness -n increase $brightness_step
bindsym XF86KbdBrightnessDown exec $backlight_path/brightness -n decrease $brightness_step
Reload i3 configuration by pressing mod+Shift+r
Use your keyboard backlight brightness keys to increase or decrease your brightness.When notifications are enabled a popup will display the brightness level.
Several different programs are supported for on-screen notifications. Including but not limited to dunst and notify-osd. See the notifications
command for a list of supported notification methods.
This script does not require any particular desktop environment and can be used as a standalone script.
Usage: ./brightness [<options>] <command> [<args>]
Control keyboard backlight brightness.
Commands:
increase <value> increase brightness
decrease <value> decrease brightness
notifications show available notification methods
help display help
Options:
-e <expires> expiration time of notifications in ms
-i <icon> name of keyboard brightness icon
-n enable notifications
-N <method> notification method (default: libnotify)
-p enable progress bar
-h display help
### Examples
# Increase brightness only
./brightness increase
# Decrease brightness by 3
./brightness decrease 3
# Notifications using herbe, progress bar
./brightness -np -N herbe increase
# Notifications using libnotify with notify-send, custom icon name, expiration time of 2.5 seconds
./brightness -n -i keyboard-brightness -e 2500 increase
# Notifications using libnotify with dunstify, custom symbolic icon, custom dunstify path
env DUNSTIFY_PATH=/path/to/dunst/ ./brightness -npy -i keyboard-brightness-symbolic increase
# Notifications using XOSD
./brightness -n -N xosd increase
Version 2 introduces commands which makes it incompatible with previous versions. Your command-line usage and/or configured hotkeys need to be updated to reflect this.
Change | v1 | v2 |
---|---|---|
-d is now the decrease command |
brightness -d 1 |
brightness decrease |
-i is now the increase command |
brightness -i 1 |
brightness increase |
i3-kb-backlight
is released under GNU General Public License v2
Copyright (C) 1989, 1991 Free Software Foundation, Inc.