summaryrefslogtreecommitdiff
path: root/ar/.local/bin/statusbar/sb-brightness
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-01-11 06:06:27 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-01-11 06:06:27 +0900
commiteeaa5670e9bbf54af3f5577f6631a72fb3d562de (patch)
tree823ddf2e88b07c97592b9b9d776f6db1d6a97265 /ar/.local/bin/statusbar/sb-brightness
parentb15632ee7226179d9b7a40f8626f55eed29c92c3 (diff)
updates
Diffstat (limited to 'ar/.local/bin/statusbar/sb-brightness')
-rwxr-xr-xar/.local/bin/statusbar/sb-brightness28
1 files changed, 24 insertions, 4 deletions
diff --git a/ar/.local/bin/statusbar/sb-brightness b/ar/.local/bin/statusbar/sb-brightness
index 909e676..625e69e 100755
--- a/ar/.local/bin/statusbar/sb-brightness
+++ b/ar/.local/bin/statusbar/sb-brightness
@@ -1,11 +1,31 @@
#!/bin/sh
+monitor=$(xrandr --query | grep -i '\sconnected' | grep '[0-9]x[0-9]' | grep -i 'primary' | cut -d ' ' -f1)
+[ -z "$monitor" ] && monitor=$(xrandr --query | grep -i '\sconnected' | grep '[0-9]x[0-9]' | cut -d ' ' -f1)
+case "$monitor" in
+*DP* | *HDMI*)
+ current_brightness=$(xrandr --verbose | grep -i "^$monitor connected" -A5 | grep -i "Brightness:" | cut -d ' ' -f2)
+ current_brightness=$(echo "$current_brightness * 100" | bc -l)
+ ;;
+esac
+
case $BLOCK_BUTTON in
3) notify-send "🔆 Backlight module
-- Scroll up & down changes backlight" ;;
-4) monbright -inc 5 ;;
-5) monbright -dec 5 ;;
+- Scroll up & down changes screen brightness
+- Shift + Scroll up & down changes monitor backlight" ;;
+4) pkexec brillo -A 5 -q ;;
+5) pkexec brillo -U 5 -q ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+7) monbright -inc 5 ;;
+8) monbright -dec 5 ;;
+9) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-monitorbright
+if [ -r /sys/class/backlight/*/brightness ]; then
+ curr_brightness=$(cat /sys/class/backlight/*/brightness)
+ max_brightness=$(cat /sys/class/backlight/*/max_brightness)
+ brightness_per=$((100 * curr_brightness / max_brightness))
+ printf "%s %s\n" "💡${brightness_per}%" "🪟$current_brightness"
+else
+ printf "%s\n" "🪟$current_brightness"
+fi