-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbacklightrc
23 lines (20 loc) · 1.41 KB
/
backlightrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#-*- Mode: Ratpoisonrc -*-
## Backlight control via direct access in /sys
#
# Needs udev rules to give write perms to /sys/class/backlight/<backlight>/brightness
# See: examples/99-backlight.udev.rules for an example on how to do this
#
# Can be customized with variables rp_backlight_path and rp_backlight_step_percent
#
# Examples:
#
# setenv rp_backlight_path /sys/class/backlight/my_backlight
# setenv rp_backlight_step_percent 3
# source /home/my-user/.config/ratpoison/backlightrc
#
####
exec bp="${rp_backlight_path:-/sys/class/backlight/intel_backlight}"; mul="${rp_backlight_step_percent:-6}"; max=$(cat "${bp}/max_brightness"); ratpoison -c "setenv rp_backlight_path ${bp}" -c "setenv rp_backlight_step_percent ${mul}" -c "setenv rp_backlight_max ${max}" -c "setenv rp_backlight_step $((mul * max / 100))"
alias backlight-inc exec x=$(( $(cat "${rp_backlight_path}/brightness") + rp_backlight_step )); x=$(( (x > rp_backlight_max) ? rp_backlight_max : x )); echo "${x}" > "${rp_backlight_path}/brightness"; ratpoison -c "echo $(cat "${rp_backlight_path}/brightness")"
alias backlight-dec exec x=$(( $(cat "${rp_backlight_path}/brightness") - rp_backlight_step )); x=$(( (x < 0) ? 0 : x )); echo "${x}" > "${rp_backlight_path}/brightness"; ratpoison -c "echo $(cat "${rp_backlight_path}/brightness")"
definekey top XF86MonBrightnessUp backlight-inc
definekey top XF86MonBrightnessDown backlight-dec