diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-11 06:06:27 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-01-11 06:06:27 +0900 |
| commit | 99df28c440fd72ac391dc679ff3e4b8bd739a118 (patch) | |
| tree | 070f0f6279b8caad0a18272914e4de0dca45349a /ar/.local/bin/statusbar/sb-brightness | |
| parent | 13a9ed632e1ddea0135a5069d620a9451d0d6bd3 (diff) | |
updates
Diffstat (limited to 'ar/.local/bin/statusbar/sb-brightness')
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-brightness | 28 |
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 |
