Created
May 6, 2018 20:03
-
-
Save GiorgioAresu/d2edd695ff88faa0484508d7398ba6fe to your computer and use it in GitHub Desktop.
Script to add a custom resolution when it doesn't get detected automatically (ie. ultrawide)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 5 ] | |
then | |
echo "Usage: $0 (add|del) display hres vres refresh" | |
exit 1 | |
fi | |
mode=$1 | |
display=$2 | |
hres=$3 | |
vres=$4 | |
ref=$5 | |
modename=$(cvt $hres $vres $ref|sed -n '2p'|cut -d\ -f2) | |
modeline=$(cvt $hres $vres $ref|sed -n '2p'|cut -d\ -f2-) | |
if [ $mode == "add" ] | |
then | |
xrandr --newmode $modeline | |
xrandr --addmode $display $modename | |
echo "To set mode, use: xrandr --output $display --mode $modename" | |
elif [ $mode == "del" ] | |
then | |
xrandr --delmode $display $modename | |
xrandr --rmmode $modename | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment