View Single Post
Old 10-18-2019, 09:11 AM   #8
edge-case
Junior Member
 
Join Date: Oct 2019
Posts: 2
Talking Bash script works great!

The bash script worked very well for me and solved my problem, thank you! I wanted to add a few more details for others like me that might not be familiar with running bash scripts.

Step one - take the code below and copy paste it into a text editor, for example, gedit. Then save the file with any name you want, or something like fixresolution.sh.

Save it in a folder that is easy to find or navigate to.

Quote:
Originally Posted by jei View Post

Code:
#!/bin/bash

# Adjust these parameters to your needs.
# These worked for me (AOC E1659Fwu)
OUTPUT="DVI-I-1-1"
HORIZONTAL_RES="1360"
VERTICAL_RES="768"

MODELINE="$(cvt ${HORIZONTAL_RES} ${VERTICAL_RES} | tail -n 1 | awk '{for (i=3; i<=NF; i++) print $i}')"
MODELINE_NAME=$(echo ${MODELINE} | awk '{print $1}' | sed -e 's/^"//' -e 's/"$//')

echo "Modeline:"
echo ${MODELINE_NAME} ${MODELINE}
echo

echo "[*] xrandr --newmode"
xrandr -d :0 --newmode ${MODELINE_NAME} ${MODELINE}

echo "[*] xrandr --addmode (${OUTPUT})"
xrandr -d :0 --addmode "${OUTPUT}" ${MODELINE_NAME}

echo "[*] Set new resolution"
xrandr -d :0 --output "${OUTPUT}" --mode ${MODELINE_NAME}
Step two - open a terminal (Ctrl-Alt-T), and cd to the same directory where fixresolution.sh is stored. Alternatively, you can navigate to that folder in a window, then right click and choose "Open in terminal"

Step three - in the terminal, type:

Code:
 
chmod +x fixresolution.sh
./fixresolution.sh

Last edited by edge-case; 10-18-2019 at 10:19 AM.
edge-case is offline   Reply With Quote