#!/bin/sh if [ $1 = '-d' ]; then current=$(xrandr --verbose | grep -m 1 -i brightness | awk -F' ' '{ print $2 }') new=$(echo "$current - 0.1" | bc -l) xrandr --output eDP-1 --brightness 0$new percent=$(echo "$new * 100" | bc -l) notify-send "Brightness lowered to ${percent}%" elif [ $1 = '-u' ]; then current=$(xrandr --verbose | grep -m 1 -i brightness | awk -F' ' '{ print $2 }') new=$(echo "$current + 0.1" | bc -l) xrandr --output eDP-1 --brightness 0$new percent=$(echo "$new * 100" | bc -l) notify-send "Brightness raised to ${percent}%" elif [ $1 = '-m' ]; then xrandr --output eDP-1 --brightness 1 notify-send "Brightness reset to 100%" else xrandr --output eDP-1 --brightness $1 fi