mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
22 lines
507 B
Plaintext
22 lines
507 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
# Set how much you want the brightness to change
|
||
|
DELTA=2
|
||
|
|
||
|
# Get the current light level, rounded to an integer
|
||
|
LIGHT=$(printf '%.*f' 0 $(xbacklight -get))
|
||
|
NEW_LIGHT=$LIGHT
|
||
|
|
||
|
# If called from i3blocks, and scrolling, then change light level
|
||
|
case $BLOCK_BUTTON in
|
||
|
5) NEW_LIGHT=$(expr $LIGHT + $DELTA) ;;
|
||
|
4) NEW_LIGHT=$(expr $LIGHT - $DELTA) ;;
|
||
|
esac
|
||
|
|
||
|
xbacklight -set $NEW_LIGHT -time 0 -steps 1
|
||
|
|
||
|
# Output the new light level
|
||
|
OUTPUT=$(printf '%.*f%%' 0 $(xbacklight -get))
|
||
|
echo $OUTPUT
|
||
|
echo $OUTPUT
|