Summary Files Commits Branches @commit @diff @stats
path: root / openbox_de / bin / brightness-control
diff options
context:
space:
mode:
Commit3056b07286c61833f8caa5a2d7e784c441a29647 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-11-01 18:07:05 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-11-01 18:07:05 +0200
Files88ad62aff3773850fbffab06a2d5c8f793a2c6f4 /openbox_de/bin/brightness-control
.files-3056b07286c61833f8caa5a2d7e784c441a29647.tar
.files-3056b07286c61833f8caa5a2d7e784c441a29647.tar.gz
.files-3056b07286c61833f8caa5a2d7e784c441a29647.zip
Parent442733b9e46e7adbd85709a53dfb85462896af7f (diff)
fix(openbox_de): Move openbox_de-related scripts to openbox_de
1 files changed, 28 insertions, 0 deletions
-rwxr-xr-xopenbox_de/bin/brightness-control28
diff --git a/openbox_de/bin/brightness-control b/openbox_de/bin/brightness-control
new file mode 100755
index 0000000..3aa2139
--- /dev/null
+++ b/openbox_de/bin/brightness-control
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+if [ -z "$@" ] || ([ "$1" != "+" ] && [ "$1" != "-" ]); then
+ echo "Expected + or - as argument!"
+ exit 1
+fi
+
+# Percentage change depending on brightness
+info=$(brightnessctl -m i | cut -d , -f 4)
+info=${info::-1}
+
+change=5
+if [ "$info" -ge 70 ]; then
+ change=10
+fi
+
+# Brightness change
+if [ "$1" == "+" ]; then
+ brightnessctl -q set "+${change}%"
+elif [ "$info" -gt 5 ]; then # don't allow brightness to decrease to 0%
+ brightnessctl -q set "${change}%-"
+fi
+
+# Notification for brightness
+info=$(brightnessctl -m i)
+perbright=$(echo $info | cut -d , -f 4)
+notify-send "$(echo $info | cut -d , -f 1)
+Brightness: $perbright" -t 1000 -h int:value:$perbright -h string:x-canonical-private-synchronous:anything -h string:x-canonical-private-synchronous:anything