Albus
12/14/2018 - 7:22 AM

Ubuntu customscreen resolution

#!/bin/sh -e
RES="1920 1280 60" && \
DISP=$(/usr/bin/xrandr | /bin/grep -e " connected [^(]" | /bin/sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") && \
MODELINE=$(/usr/bin/cvt $(/bin/echo $RES) | /bin/grep -e "Modeline [^(]" | /bin/sed -r 's/.*Modeline (.*)/\1/') && \
MODERES=$(echo $MODELINE | /bin/grep -o -P '(?<=").*(?=")') && \
cat > ~/.xprofile << _EOF
#!/bin/sh
xrandr --newmode $MODELINE
xrandr --addmode $DISP $MODERES
exit 0
_EOF
chmod +x ~/.xprofile
ls -lh ~/.xprofile
cat ~/.xprofile