#!/bin/bash
display_path=/sys/class/backlight/ae94000.dsi.0/brightness
offset_dir=${1:0:1}
offset_amnt=${1:1}
cur_brightness=$(cat $display_path)
if [[ "$offset_dir" = "+" ]]
then
	echo "$(( $cur_brightness + $offset_amnt ))" | tee $display_path 
elif [[ "$offset_dir" = "-" ]]
then
	echo "$(( $cur_brightness - $offset_amnt ))" | tee $display_path 
elif [[ "$1" = "toggle" ]]
then
	if [[ $cur_brightness -gt 0 ]]
	then
		echo $cur_brightness > /tmp/brightness
		echo 0 | tee $display_path 
		xinput disable 7
		xinput disable 10
		xinput disable 11
	else
		cat /tmp/brightness | tee $display_path 
		xinput enable 7
		xinput enable 10
		xinput enable 11
	fi

else
	echo "$1" | tee $display_path 
fi

