#!/bin/sh # ================================== # License : The Unlicense # Author : sabr@ariamath.xyz # Version : 0.0.1 # ================================== # Honestly, brightnessctl is bloat. # ================================== device="$(find /sys/class/backlight/*)" fmax="${device}/max_brightness" fcur="${device}/brightness" m="$(cat "${fmax}")" c="$(cat "${fcur}")" if [ $# -gt 1 ]; then case "$1" in "-s") printf "%d" "$(($2 * m / 100))" > "${fcur}" ;; "-i") printf "%d" "$((c + $2 * m / 100))" > "${fcur}" ;; "-d") printf "%d" "$((c - $2 * m / 100))" > "${fcur}" ;; esac notify-send "Brigthness Info" "Current Brightness: $((c * 100 / m))%" else case "$1" in "-v") printf "brl v0.0.1\n" printf "A simple brightness control program\n" ;; "-h"|"--help") printf "brl [options] [value]\n" printf " -s set brightness %%\n" printf " -i increase brightness %%\n" printf " -d decrease brightness %%\n" ;; *) printf "Current brightness: %d%% (%d)\n"\ $((c * 100 / m)) "$c" ;; esac fi