dotfiles/i3/scripts/brightness.sh

18 lines
659 B
Bash
Raw Permalink Normal View History

2017-09-20 17:23:24 +02:00
#! /bin/bash
displays=($(xrandr | awk '/ connected /{print $1}'))
if (( ${#displays[@]} > 1 ))
then
selected_display="$(zenity --list --title 'Select Display' --radiolist --column '' --column 'Display' $(xrandr | awk '/ connected /{print NR,$1}'))"
else
selected_display="${displays[0]}"
fi
current_brightness=($(xrandr --current --verbose | grep -m1 Brightness | awk '{print $2}' | sed 's/0.//' | sed 's/.0/00/' ))
zenity --scale --title "Set brightness of $selected_display" --value=$current_brightness --print-partial |
2017-09-20 17:23:24 +02:00
while read brightness
do
xrandr --output "$selected_display" --brightness $(awk '{print $1/100}' <<<"$brightness"})
done