aboutsummaryrefslogtreecommitdiff
path: root/sbc
diff options
context:
space:
mode:
Diffstat (limited to 'sbc')
-rwxr-xr-xsbc34
1 files changed, 34 insertions, 0 deletions
diff --git a/sbc b/sbc
new file mode 100755
index 0000000..e269c16
--- /dev/null
+++ b/sbc
@@ -0,0 +1,34 @@
+#!/bin/sh
+# ====================================
+# Program : brl (brightness control)
+# License : The Unlicense
+# Author : sabr@ariamath.xyz
+# Version : 0.0.1
+# ====================================
+# Honestly, brightnessctl is bloat.
+# ====================================
+device="$(find /sys/class/backlight/*)"
+fmax="${device}/max_brightness"
+fnow="${device}/brightness"
+m="$(cat "${fmax}")"
+c="$(cat "${fnow}")"
+v=$2
+case "$1" in
+ "-s") printf "%d" $((v * m / 100)) > "${fnow}";;
+ "-i") printf "%d" $((c + v * m / 100)) > "${fnow}";;
+ "-d") printf "%d" $((c - v * m / 100)) > "${fnow}";;
+ "-v")
+ printf "brl v0.0.1\n"
+ printf "A simple brightness control program\n"
+ ;;
+ "-h")
+ 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