keyboard-brightness.sh 532 B

12345678910111213141516
  1. #!/bin/sh
  2. # script to set the keyboard backlight brightness by the passed amount ($1)
  3. device=$(brightnessctl -l | grep "kbd_backlight" | head -n 1 | awk '{print $2}' | tr -d "'")
  4. brightnessctl -d "$device" set "$1"
  5. PERCENT=$(brightnessctl -m -d "$device" | awk -F, '{print $4}' | tr -d '%')
  6. notify-send -i keyboard-brightness-symbolic \
  7. -h int:transient:1 \
  8. -h int:SWAYNC_BYPASS_DND:1 \
  9. -h string:x-canonical-private-synchronous:brightness \
  10. -h int:value:"$PERCENT" \
  11. -t 1500 \
  12. "Brightness: ${PERCENT}%"