6 screen_brightness_device_path
="/sys/class/backlight/intel_backlight"
8 # Padding with space because when fun="=10", awk fails to parse fun==10
11 FILENAME ~ "/max_brightness$" {max = $1; next}
12 FILENAME ~ "/brightness$" {cur = $1; next}
16 oper = substr(fun, 2, 1)
17 units = substr(fun, 3, length(fun) - 1)
18 if (oper == "=") {new = unit * units} else
19 if (oper == "+") {new = cur + (unit * units)} else
20 if (oper == "-") {new = cur - (unit * units)} else {
21 printf("Unrecognized operator: %s\n", oper) > "/dev/stderr"
27 "$screen_brightness_device_path/max_brightness" \
28 "$screen_brightness_device_path/brightness"
31 echo "${new}" |
tee "${screen_brightness_device_path}/brightness"