dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 6b28ed443db959b4d031f983637ec0f251fba428
parent d562a190ab71ccecf6e292ffecb39ed3b3e3bc86
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sat, 28 Sep 2019 14:05:35 -0400

xrandr-brightness: preserve gamma

Former-commit-id: c44bc1ca10cc272856afec9f484428a9cb3700ab
Diffstat:
Mscripts/xrandr-brightness | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/xrandr-brightness b/scripts/xrandr-brightness @@ -1,14 +1,19 @@ #!/bin/sh if [ "$1" = "up" ]; then brightness="$(xrandr --verbose |grep Brightness |grep -o '[0-9].*')" + gamma="$(xrandr --verbose | grep Gamma | tr -d ' \t\n' | awk -F: '{ printf "%f:%f:%f", 1/$2, 1/$3, 1/$4 }')" if ! [ "$brightness" = "1.0" ]; then - xrandr --output LVDS-0 --brightness $(echo "$brightness 0.05" | awk '{printf "%f", $1 + $2}') + xrandr --output LVDS-0 --gamma "$gamma" --brightness $(echo "$brightness 0.05" | awk '{printf "%f", $1 + $2}') fi elif [ "$1" = "down" ]; then brightness="$(xrandr --verbose |grep Brightness |grep -o '[0-9].*')" + gamma="$(xrandr --verbose | grep Gamma | tr -d ' \t\n' | awk -F: '{ printf "%f:%f:%f", 1/$2, 1/$3, 1/$4 }')" if ! [ "$brightness" = "0.0" ]; then - xrandr --output LVDS-0 --brightness $(echo "$brightness 0.05" | awk '{printf "%f", $1 - $2}') + xrandr --output LVDS-0 --gamma "$gamma" --brightness $(echo "$brightness 0.05" | awk '{printf "%f", $1 - $2}') fi elif [ "$1" = "gamma" ]; then - xrandr --output LVDS-0 --gamma "$2" + brightness="$(xrandr --verbose |grep Brightness |grep -o '[0-9].*')" + xrandr --output LVDS-0 --gamma "$2" --brightness "$brightness" +else + echo "up, down, gamma r:g:b" fi