Files
Scripts/Prime-Gamma/prime-gamma.sh
Dunestorm c97a0c5c25 [Prime-Gamma]
- Separated resolution and gamma changes for less runtime overhead.
- Input parameters now supported and required.
- Pause between resolution and gamma change to make changing gamma
reliable.
2020-06-10 18:04:15 +01:00

44 lines
762 B
Bash
Executable File

#!/bin/sh
R_GAMMA_VALUE=0.7
G_GAMMA_VALUE=0.7
B_GAMMA_VALUE=0.7
DISPLAY_RES="2560x1440"
REFRESH_RATE=143.91
DISPLAYS=( "HDMI-0" )
_FLAG_RESOLUTION=0
_FLAG_GAMMA=0
#_GET_CONNECTED_DISPLAY=`xrandr | grep -w connected | awk '{print $1}'`
for arg in "$@"; do
case "$arg" in
-r|--resolution)
_FLAG_RESOLUTION=1
shift
;;
-g|--gamma)
_FLAG_GAMMA=1
shift
;;
esac
done
for d in "${DISPLAYS[@]}"
do
if [[ ${_FLAG_RESOLUTION} -eq 1 ]]; then
/usr/bin/xrandr --output $d \
--mode $DISPLAY_RES \
--rate $REFRESH_RATE \
> /dev/null 2>&1
sleep 5
fi
if [[ ${_FLAG_GAMMA} -eq 1 ]]; then
/usr/bin/xrandr --output $d \
--gamma $R_GAMMA_VALUE:$G_GAMMA_VALUE:$B_GAMMA_VALUE \
> /dev/null 2>&1
fi
done
exit 0