1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00
dotfiles/.config/i3/blocks/backlight

22 lines
507 B
Plaintext
Raw Normal View History

2016-12-04 13:58:25 +00:00
#!/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